formatBlock div isn't possible when executed in a <p> [contenteditable, execCommand]
Categories
(Core :: DOM: Editor, defect, P5)
Tracking
()
Tracking | Status | |
---|---|---|
firefox121 | --- | fixed |
People
(Reporter: cyril.auburtin, Assigned: masayuki)
References
(Blocks 1 open bug)
Details
(Whiteboard: dom-triaged, [wptsync upstream])
Attachments
(4 files)
Updated•10 years ago
|
Comment 1•5 years ago
|
||
Bulk-downgrade of unassigned, untouched DOM/Storage bug's priority.
If you have reason to believe, this is wrong, please write a comment and ni :jstutte.
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 2•2 years ago
|
||
I realized that our HTMLEditUtils::IsFormatNode
is not maintained different
from the other browsers. Therefore, only we do not check new elements defined
after HTML 4.01. This patch aligns the list of the format elements to the
others [1].
Then, this also changes some expectations of editing/run/formatblock.html
to align common behavior of the browsers.
Note that we mapped formatBlock
of execCommand
to cmd_paragraphState
,
and the XUL command handles <blockquote>
in a different path [2] and the
behavior is pretty different from the other formatBlock command implementations.
Therefore, this patch creates new command for formatBlock
and makes
HTMLEditor
switch behavior in any places.
Assignee | ||
Comment 3•2 years ago
|
||
Document.execCommand
accepts dl
, dt
and dd
as a format block. However,
ParagraphStateAtSelection
ignores them as not a format block element.
Therefore, it causes odd result of queryCommandValue
after applying the
format. E.g., execCommand("dd")
to <p>[foobar]</p>
correctly updates the
HTML to <dl><dd>foobar</dd></dl>
, however, queryCommandValue("dd")
returns
empty string rather than dd
.
Note that Chromium returns inclusive ancestor format element of common ancestor
of the range. However, the behavior is odd because it makes the indeterm
state never true
and the result is not used as the target of format block
command. So, this patch does not follow them at least for now.
On the other hand, this patch adds special case for dl
. With user's
operation in valid HTML structure, selection range never selects <dl>
children directly. However, may cross <dt>
and <dd>
elements.
Then, let's return dl
for compatibility with Chromium because <dl>
ancestor may be the format block target.
Depends on D190900
Assignee | ||
Comment 4•2 years ago
|
||
Currently, we extend selection to outside block boundaries if selection starts
and/or ends very start/end of block boundaries. Then, replace most-distant
ancestor format node, but this is odd because the innermost format is applied
to the text and the other browsers targets the innermost ancestor formant node.
Therefore, we should align to them.
Additionally, our replacing code for <dd>
and <dt>
has not been implemented
yet. I guess that the old HTMLEditUtils::IsFormatNode
returned false
for
<dd>
, <dl>
and <dt>
and it requires additional work for splitting parent
<dl>
too. Now, we can do it with simple code.
Finally, we created new format block element if <br>
element appears, but
the other browsers moves it into the new format node simply. Therefore, we
should follow them (about <blockquote>
, we've already done this within
the different path).
Depends on D190901
Assignee | ||
Comment 5•2 years ago
|
||
Now, all callers of them do not require to check <dl>
, <dt>
and <dd>
check
if it's in the HTML format block mode. Therefore, we can move the check into
HTMLEditor::IsFormatElement
to make the caller side simpler.
Additionally, this patch replaces some places with
HTMLEditUtils::IsFormatElementForParagraphState
because the paths handle only
XUL paragraph state command with assertion check.
Depends on D190902
Comment 8•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/d3a22d72bc35
https://hg.mozilla.org/mozilla-central/rev/3fced6258607
https://hg.mozilla.org/mozilla-central/rev/77bccdc1a9b6
https://hg.mozilla.org/mozilla-central/rev/6951f8fc8821
Description
•