Skip to content

Commit

Permalink
Bug 1920646 - part 1: Make HTMLEditor paste/drop things as plaintex…
Browse files Browse the repository at this point in the history
…t when `contenteditable=plaintext-only` r=m_kato

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. w3c/input-events#162

Differential Revision: https://phabricator.services.mozilla.com/D223908

UltraBlame original commit: 2e3f866560e2c750fe1e4469b81d89f10bffc6a1
  • Loading branch information
marco-c committed Oct 9, 2024
1 parent ed8fb37 commit 8e00c94
Show file tree
Hide file tree
Showing 8 changed files with 5,136 additions and 114 deletions.
50 changes: 49 additions & 1 deletion editor/libeditor/HTMLEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -21598,6 +21598,13 @@ nsIClipboard
kSelectionClipboard
.
*
param
aEditingHost
The
editing
host
.
*
/
MOZ_CAN_RUN_SCRIPT
nsresult
Expand All @@ -21608,6 +21615,10 @@ nsIClipboard
:
ClipboardType
aClipboardType
const
Element
&
aEditingHost
)
;
[
Expand Down Expand Up @@ -22037,6 +22048,10 @@ const
nsAString
&
aStringToInsert
const
Element
&
aEditingHost
)
;
/
Expand Down Expand Up @@ -25494,8 +25509,20 @@ nsIClipboard
:
ClipboardType
aSelectionType
const
Element
&
aEditingHost
)
;
enum
class
AddCites
{
No
Yes
}
;
/
*
*
Expand Down Expand Up @@ -25551,6 +25578,13 @@ added
.
)
*
param
aEditingHost
The
editing
host
.
*
return
aNodeInserted
The
Expand Down Expand Up @@ -25586,12 +25620,18 @@ const
nsAString
&
aQuotedText
bool
AddCites
aAddCites
const
Element
&
aEditingHost
nsINode
*
*
aNodeInserted
=
nullptr
)
;
/
Expand Down Expand Up @@ -25653,6 +25693,10 @@ nsITransferable
*
*
aTransferable
const
Element
*
aEditingHost
)
const
;
Expand Down Expand Up @@ -25749,6 +25793,10 @@ EditorDOMPoint
aDroppedAt
DeleteSelectedContent
aDeleteSelectedContent
const
Element
&
aEditingHost
)
;
static
Expand Down
Loading

0 comments on commit 8e00c94

Please sign in to comment.