Hello,
I was wondering what is the best way to prevent deletion of specific node types …?
Currently I’m using a filterTransaction
plugin with something like:
addProseMirrorPlugins() {
return [
new Plugin({
filterTransaction(transaction, state) {
let return_value = true
transaction.steps.forEach((step, index) => {
state.doc.nodesBetween(
step.from, step.to, (node, pos) => {
if (step.from < pos && step.to > pos) {
if (node.type.name == 'flexItem') {
return_value = false
return false
}
}
}
)
})
return return_value
}
})
];
},
is there any better way of doing it ..?
Thanks !