({ element }: { element: TElement })
| 2 | import type { TElement } from '@platejs/slate'; |
| 3 | |
| 4 | export const useRemoveNodeButton = ({ element }: { element: TElement }) => { |
| 5 | const editor = useEditorRef(); |
| 6 | |
| 7 | return { |
| 8 | props: { |
| 9 | onClick: () => { |
| 10 | const path = editor.api.findPath(element); |
| 11 | |
| 12 | editor.tf.removeNodes({ at: path }); |
| 13 | }, |
| 14 | onMouseDown: (e: React.MouseEvent<HTMLButtonElement>) => { |
| 15 | e.preventDefault(); |
| 16 | }, |
| 17 | }, |
| 18 | }; |
| 19 | }; |
no test coverage detected
searching dependent graphs…