Open zcorpan opened 1 year ago
Handling steps of
Document.execCommand("insertParagraph"
) (Chrome/Safari handle this command differently from pressing Enter)
https://software.hixie.ch/utilities/js/live-dom-viewer/saved/11814 (compare with contenteditable=true
). Chrome and Safari insert a div
and insert following sibling text to it (for both plaintext-only and true). Gecko (for contenteditable=true
) results in two div
s, one for x
and one for z
.
Handling steps of
Document.execCommand("insertLineBreak"
) (LF vs<br>
(Chrome vs. Safari)
LF seems more useful for plaintext-only.
Handling steps of
Document.execCommand("insertLineBreak"
) (LF vs<br>
(Chrome vs. Safari)LF seems more useful for plaintext-only.
Yeah, if linebreaks are not preserved like white-space: normal
, should be <br>
? (I guess yes.)
And I wonder, if contenteditable
value is changed from ""
/"plaintext-only"
to the other value in a beforeinput
event handler, how do Chrome/Safari handle it...? Especially when it's switched from ""
to "plaintext-only"
and the command is not acceptable for the plaintext-only
, e.g., bold
command which is available with Accel
+B
except in Firefox.
Blink uses ShouldUseBreakElement
to determine whether to insert <br>
or LF; so it checks both plaintextonly
and white-space-collapse
.
See https://bugzilla.mozilla.org/show_bug.cgi?id=1291467#c17 by @masayuki-nakano
cc @howard-e