New issue
Advanced search Search tips

Issue 880115 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Sep 4
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

Abnormal behavior when pasting /r/n into the contenteditable="plaintext-only" node

Reported by vhp...@msn.com, Sep 3

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36

Steps to reproduce the problem:
1.

Build a string: some normal characters with \r\n end, like this:

0x41 0x0d 0x0a

2.

Select all the string, and paste it into a contenteditable="plaintext-only" node with no children

3.

There will be an extra <div><br></div> appearing at the end of the editable node

What is the expected behavior?

What went wrong?
I think the contenteditable="plaintext-only" node should NOT have child nodes other than the text node

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 68.0.3440.106  Channel: n/a
OS Version: 10.0
Flash Version:
 
testhtml.html
213 bytes View Download
teststring.txt
6 bytes View Download
AfterPasting.png
49.4 KB View Download
Labels: Needs-Triage-M68
Cc: viswa.karala@chromium.org
Components: Blink>Editing
Labels: Triaged-ET Needs-Feedback
Unable to reproduce the issue on chrome reported version# 68.0.3440.106 using Windows-10 with steps mentioned below:
1) Launched chrome reported version, dragged and dropped the '.html' file provided in comment# 0
2) Entered text "A" in the field and opened Devtools, in elements tab observed "<div>A</div>"

@Reporter: Please find the attached screencast for your reference and provide your feedback on it which helps us in further triaging the issue in better way.
Note: Tentatively adding Blink>Editing component to it.
Thanks!
880115.mp4
928 KB View Download
Status: WontFix (was: Unconfirmed)
This is expected behavior. If you want to have newline characters in node, you need to have "white-space: pre" CSS property.
@ viswa.karala@chromium.org

I recorded a GIF can reproduce the whole process, please check.
temp.gif
1.2 MB View Download
@ yosin@chromium.org

After my test, even if "white-space: pre;" is set, this behavior will still occur. Please check the GIF of my last comment.

"white-space: pre;" is not set in GIF, but you can follow my steps to reproduce it with "white-space: pre;".
The last <div><br></div>, aka placeholder <br>, is needed to represent newline.
This is as same as <textarea>, which contents in UA shadow tree.
But why does the <div><br></div> appear only when \r\n is at the end of the pasted content? If \r\n is not at the end, after pasting, whole content will become an entire text node. The <div><br></div> will cause the continued input content to be entered into this sub <div> instead of the first-level-contenteditable-node.
I mean, after pasting,

A\r\n

↑ will become ↓

["A
"<div><br></div>]

but,

A\r\nB

↑ will become ↓

["A
B"]

([ ] represents children of the contenteditable node, " " represents a text node)

You can see, in first case, the text node already has an internal newline, so <div><br></div> is redundant.

Sign in to add a comment