Open zbeyens opened 4 years ago
This is due to this code in mergeNodes
which has the comment:
"If the target node that we're merging with is empty, remove it instead of merging the two. This is a common rich text editor behavior to prevent losing formatting when deleting entire nodes when you have a hanging selection."
You can see this more clearly exemplified in the table example where, if you clear the content of the final cell, then press backspace at the start of the next paragraph, it removes the cell:
To provide even more information, the code I referenced above removes the lowest empty block you're deleting into. What this means is that as long as you have paragraphs within these nodes, the paragraph will be deleted (great!) and not the empty block containing it. This is a gotcha, but it may not be a bug.
Hi @pottedmeat Is there any solution to this yet in the tables? This happens even when you shift select cells and press backspace. It removes the cells and the table looks messed.
Do you want to request a feature or report a bug?
Bug
What's the current behavior?
li
(with empty text) is replaced by ap
ondeleteBackward
.Workaround until it's fixed:
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