Pasting plaintext into the filed in discussions.apple.com gets lost the containg line breaks
Categories
(Core :: DOM: Editor, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox-esr128 | --- | unaffected |
| firefox134 | --- | unaffected |
| firefox135 | --- | fixed |
| firefox136 | --- | verified |
People
(Reporter: masayuki, Assigned: masayuki)
References
(Regression)
Details
(Keywords: regression)
Attachments
(1 file)
|
48 bytes,
text/x-phabricator-request
|
RyanVM
:
approval-mozilla-beta+
|
Details | Review |
##STR
- Load https://discussions.apple.com/community/macos/sequoia
- Go to an article
- Press "reply" button
- Paste multi-line text into the field (use
Ctrl/Cmd-Shift-Vto paste rich text as plaintext)
##AR
multiple lines are pasted as single line text
##ER
each line should be pasted as within its owning line
| Assignee | ||
Comment 1•1 year ago
|
||
First, it seems that the web app itself removes the pasted new lines which are preformatted by white-space: pre-wrap.
However, before bug 1921180, we pasted the pasted text as HTML. So, we should revert the code partially for contenteditable="true" cases.
| Assignee | ||
Comment 2•1 year ago
|
||
Oh, wait, but Chrome also using preformatted linefeeds in <div contenteditable style="white-space:pre-wrap"><p><br></p></div>. So, partially reverting our behavior causes incompatible with Chrome in the other web apps in the same situation.
| Assignee | ||
Comment 3•1 year ago
|
||
If I disable the paste event listener of the editing host in Chrome, the form will have the plaintext as-is, so, they handle paste by themselves only for Chrome. (I verified that our editor inserts text when I paste plaintext on debug build.)
| Assignee | ||
Comment 4•1 year ago
|
||
Ah, okay, I got it.
Chrome inserts only a preformatted linefeed Text when Shift + Enter, etc. However, pasting plaintext inserts only one Text node, i.e., it may contain multiple preformatted linefeeds.
Firefox keeps the consistency with any insertions, Firefox inserts multiple Text for string containing multiple linefeeds.
Once I make HTMLEditor::HandleInsertText inserts only one Text, the form works as expected.
Comment 5•1 year ago
|
||
Set release status flags based on info from the regressing bug 1921180
| Assignee | ||
Comment 6•1 year ago
|
||
The form of https://discussions.apple.com/ handles newly inserted Text nodes
asynchronously after pasted. Then, the text will be wrapped into <p>
elements. However, the handler does not assume that multiple and consecutive
Text nodes are inserted by a pasting. Therefore, they fail handling our
pasted text which was split to each line and each preformatted linefeed.
Chrome puts only one Text node at pasting multiline plaintext and following
this behavior fixes the issue in the form. Therefore, we should follow the
behavior at least for now.
| Assignee | ||
Comment 11•1 year ago
|
||
Comment on attachment 9446471 [details]
Bug 1940653 - Make HTMLEditor::HandlerInsertText insert one Text when linefeeds are preformatted r=m_kato!
Beta/Release Uplift Approval Request
- User impact if declined/Reason for urgency: Cannot paste multiline plaintext in the Apple's forum.
- Is this code covered by automated tests?: Yes
- Has the fix been verified in Nightly?: Yes
- Needs manual test from QE?: No
- If yes, steps to reproduce: 1. Load https://discussions.apple.com/community/macos/sequoia
- Go to an article
- Press "reply" button
- Paste multi-line text into the field (use Ctrl/Cmd - Shift - V to paste rich text as plaintext)
- List of other uplifts needed: None
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): We started using preformatted linefeed instead of
<br>as same as Chrome. Chrome inserts a linefeed with newTextnode when insert a linebreak (likeShift-Enter). Therefore, we follow this behavior in any cases, but Chrome does not do it when inserting multiline text once. This difference caused the issue on the web site. Therefore, this patch makes us follow the Chrome about the multiline text insertion too. Finnaly, the new path is really simple. - String changes made/needed: none
- Is Android affected?: Yes
Comment 12•1 year ago
|
||
Calling VERIFIED based on bug 1938542 comment 21.
Updated•1 year ago
|
Comment 13•1 year ago
|
||
Comment on attachment 9446471 [details]
Bug 1940653 - Make HTMLEditor::HandlerInsertText insert one Text when linefeeds are preformatted r=m_kato!
Approved for 135.0b5.
Updated•1 year ago
|
Comment 14•1 year ago
|
||
| uplift | ||
Description
•