You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can reproduce this using the current Fastmail editor:
copy in a header element, or click the button in the UI to add a list
type some text into the header/list item
make sure there are no lines below the header/list
with your cursor inside the header/list, press backspace to delete one of the characters inside of it
Expected behavior: the header/list should still be the last child element inside the root element.
Observed behavior: a new div is inserted after the header/list, containing a br. This results in a new blank line.
This does not happen if the header/list item has other elements after it, it only happens when the last child element has a nodeName that differs from _config.blockTag.
The bug is caused by a tricksily wrong conditional check here:
You can reproduce this using the current Fastmail editor:
Expected behavior: the header/list should still be the last child element inside the root element.
Observed behavior: a new
div
is inserted after the header/list, containing abr
. This results in a new blank line.This does not happen if the header/list item has other elements after it, it only happens when the last child element has a
nodeName
that differs from_config.blockTag
.The bug is caused by a tricksily wrong conditional check here:
Squire/source/Editor.ts
Lines 1924 to 1930 in cbd8881
It's a little easier to see why that's wrong after sprinkling some De Morgan over the last part of the condition:
turns into:
this will be false whenever the nodeName is equal to the blockTag, but it will be true for all other block types.
You can fix this by removing the check against _config.blockTag entirely, the
isBlock
check should be sufficient:If you expect someone to pass in a blockTag that doesn't pass the isBlock check, you could do this (I really doubt this is desirable):
Does this make sense? Would you like a PR?
The text was updated successfully, but these errors were encountered: