diff --git a/examples/EdgeWithButton/ButtonEdge.tsx b/examples/EdgeWithButton/ButtonEdge.tsx index fb00387d..2b89663f 100644 --- a/examples/EdgeWithButton/ButtonEdge.tsx +++ b/examples/EdgeWithButton/ButtonEdge.tsx @@ -1,13 +1,20 @@ -import { computed, defineComponent } from 'vue'; -import { getBezierPath, getEdgeCenter, getMarkerEnd } from '../../src'; +import { computed, defineComponent, inject } from 'vue'; +import { getBezierPath, getEdgeCenter, getMarkerEnd, RevueFlowStore } from '../../src'; import { DefaultEdgeProps } from '../../src/components/Edges/utils'; +import { RevueFlowHooks } from '../../src/hooks/RevueFlowHooks'; export default defineComponent({ props: { ...DefaultEdgeProps }, setup(props) { + const store = inject('store')!; + const hooks = inject('hooks')!; const onEdgeClick = (evt: Event, id: string) => { + const edge = store.edges.find((edge) => edge.id === id); + if (edge) { + hooks.elementsRemove.trigger([edge]); + } evt.stopPropagation(); alert(`remove ${id}`); };