Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
event.preventDefault();
tr.delete($from.pos - $from.nodeBefore.nodeSize, $from.pos);
const newSelection = Selection.near(
tr.doc.resolve(tr.mapping.map($from.pos - $from.nodeBefore.nodeSize)),
);
tr.setSelection(newSelection);
dispatch(tr);
pluginState.endDelete(newSelection);
return true;
}
/**
* This block caters for highlighting the defined nodes when a selection has been made
*/
if (
isTextSelection(selection) &&
selection.$cursor === null &&
$from.nodeAfter &&
nodeNameMatchesList($from.nodeBefore, ensureNodeDeletion)
) {
event.preventDefault();
dispatch(state.tr.deleteSelection());
return true;
}
return false;
};