Closed Bug 1920646 Opened 1 month ago Closed 23 days ago

Make HTML inserters of `HTMLEditor` aware of `contenteditable=plaintext-only`

Categories

(Core :: DOM: Editor, task)

task

Tracking

()

RESOLVED FIXED
133 Branch
Tracking Status
firefox133 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

(Blocks 1 open bug)

Details

Attachments

(2 files, 1 obsolete file)

document.execCommand("insertHTML") and the paste handlers.

Chrome sets beforeinput.data instead of beforeinput.dataTransfer, but
Input Events Level 2 spec defines that browsers should set dataTransfer when
contenteditable [1]. Therefore, the new WPT expects dataTransfer.

However, it's unclear that the dataTransfer should have text/html or only
text/plain. From web apps point of view, text/html data may make them
serialize the rich text format to plaintext without any dependencies of browsers
and OS. On the other hand, they cannot distinguish whether the user tries to
paste with or without formatting when contenteditable=true. Therefore, I
filed a spec issue for this. We need to be back later about this issue.

  1. https://w3c.github.io/input-events/#overview
  2. https://github.com/w3c/input-events/issues/162

Depends on D223670

Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/2e3f866560e2 part 1: Make `HTMLEditor` paste/drop things as plaintext when `contenteditable=plaintext-only` r=m_kato https://hg.mozilla.org/integration/autoland/rev/39f1a092f31f part 2: Make `HTMLEditor` handle `insertHTML` as inserting plaintext converted from given source r=m_kato
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/48435 for changes under testing/web-platform/tests
Status: ASSIGNED → RESOLVED
Closed: 23 days ago
Resolution: --- → FIXED
Target Milestone: --- → 133 Branch
Upstream PR merged by moz-wptsync-bot

If dom.element.contenteditable.plaintext-only.enabled is false,
the API throws an exception. Therefore, the following tests cannot check
the result. So, we should not use it. Instead,
.setAttribute("contenteditable", "plaintext-only") is fine.

Comment on attachment 9428993 [details]
Bug 1920646 - Make editing/plaintext-only stop doing .contentEditable = "plaintext-only" r=m_kato!,#dom-core

Revision D224576 was moved to bug 1922712. Setting attachment 9428993 [details] to obsolete.

Attachment #9428993 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: