slate
slate copied to clipboard
Delete backward is replacing the previous node by the current node
Do you want to request a feature or report a bug?
Bug
What's the current behavior?
li
(with empty text) is replaced by a p
on deleteBackward
.
Workaround until it's fixed:
// ...
editor.deleteBackward = (...args) => {
deleteBackward(...args);
const match = Editor.above(editor, {
match: n => unwrapTypes.includes(n.type),
});
if (match) {
// quick fix for list item
Transforms.setNodes(editor, { type: ListType.LIST_ITEM });
}
};
Slate: 0.57.1 Browser: Chrome / Safari / Firefox / Edge OS: Mac / Windows / Linux / iOS / Android
What's the expected behavior?
It should not replace the node