feat: add deleteNode method to node views
This commit is contained in:
@@ -238,4 +238,10 @@ export class NodeView<Component, Editor extends CoreEditor = CoreEditor> impleme
|
||||
this.editor.view.dispatch(transaction)
|
||||
}
|
||||
|
||||
deleteNode(): void {
|
||||
const from = this.getPos()
|
||||
const to = from + this.node.nodeSize
|
||||
|
||||
this.editor.commands.deleteRange({ from, to })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,6 +142,7 @@ export type NodeViewProps = {
|
||||
extension: Node,
|
||||
getPos: () => number,
|
||||
updateAttributes: (attributes: Record<string, any>) => void,
|
||||
deleteNode: () => void,
|
||||
}
|
||||
|
||||
export type NodeViewRendererProps = {
|
||||
|
||||
Reference in New Issue
Block a user