mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-08-06 13:38:49 +08:00
Prevent history checkpoints during backspace in empty editor (#5063)
* Prevent history checkpoints during backspace in empty editor * Remove errant comment/lint problem
This commit is contained in:
parent
3a21bc1d2f
commit
c52a6026fc
@ -27,7 +27,13 @@ export const Keymap = Extension.create({
|
|||||||
? parentPos === $anchor.pos
|
? parentPos === $anchor.pos
|
||||||
: Selection.atStart(doc).from === pos
|
: Selection.atStart(doc).from === pos
|
||||||
|
|
||||||
if (!empty || !isAtStart || !parent.type.isTextblock || parent.textContent.length) {
|
if (
|
||||||
|
!empty
|
||||||
|
|| !parent.type.isTextblock
|
||||||
|
|| parent.textContent.length
|
||||||
|
|| !isAtStart
|
||||||
|
|| (isAtStart && $anchor.parent.type.name === 'paragraph') // prevent clearNodes when no nodes to clear, otherwise history stack is appended
|
||||||
|
) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user