Closed Bug 1268941 Opened 9 years ago Closed 5 years ago

Copy/paste of code in <pre> blocks no longer includes newlines

Categories

(developer.mozilla.org Graveyard :: Editing, defect)

All
Other
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: sheppy, Unassigned)

Details

(Keywords: in-triage, Whiteboard: [specification][type:bug])

What did you do? ================ 1. Opened a page that includes code in a <pre> block, such as https://developer.mozilla.org/en-US/docs/Web/API/RTCConfiguration 2. Click Edit. 3. Scroll to the example and select and copy part of it; say, all of the lines of the definition of the variable |configuration|. 4. Go to another page (in another tab perhaps) and edit it. 5. Go to an empty line on the page and click the Syntax Highlighter>JavaScript menu option in the toolbar to insert a new JavaScript code box. 6. Click into the new box and paste. What happened? ============== The pasted code no longer has line breaks but is instead all crammed onto one line. What should have happened? ========================== Line breaks should have been preserved. Is there anything else we should know? ====================================== This has been going on for a few weeks now but I kept thinking it was something I was doing wrong. I no longer think it is, after a lot of testing.
Just realized: this is happening at COPY, not at paste.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
On March 24, 2016, we upgraded CKEditor from v4.5.4 to v4.5.7. I suspect this is what caused the paste behavior to change. There is nothing in the changelog [1] that suggests this is a planned feature. It also appears to happen in the live sample. Unlike bug 1191469, this bug reproduces in other browsers (I tried Safari). The whitespace is in the clipboard buffer, and can be pasted into a different text document. If you switch to Source mode, whitespace is preserved when pasting. I'll open a ticket w/ CKEditor. [1] https://github.com/ckeditor/ckeditor-dev/blob/master/CHANGES.md
(In reply to John Whitlock [:jwhitlock] from comment #3) > Unlike bug 1191469, this bug reproduces in other browsers (I tried Safari). > The whitespace is in the clipboard buffer, and can be pasted into a > different text document. If you switch to Source mode, whitespace is > preserved when pasting. Well.. this bug was about newlines, not whitespace. But yeah, the whitespace is getting nuked up too.
A few updates: 1. For me, the copied code has whitespace, as proven by pasting into a plain text editor. You asserted that the problem is happening at COPY. If I'm misunderstanding, please clarify. 2. I looked at all whitespace, which includes spaces, newlines, tabs, etc. See bug 1191469#c7 for the explanation, where I think we're in agreement. 3. A CKEditor maintainer answered the bug and said this was a 4.5.0 change: http://dev.ckeditor.com/ticket/14614#comment:1 j.swiderski mentioned a work-around (click on "pre" in the element selector). This works in the current CKEditor live demo, but not on MDN. More investigation is needed to see why they are different (different CKEditor version, bad plugins, etc.)
It's unclear in their response if that's an intentional change or a bug, but having to rely on workarounds for this isn't a great option (even if it did work for us, which it doesn't). Can they offer suggestions for restoring the previous behavior?
That would be a great question to ask on the CKEditor ticket. My guess is that this is an intentional change in the 4.5.x, and we need to get on board.
(In reply to John Whitlock [:jwhitlock] from comment #8) > That would be a great question to ask on the CKEditor ticket. My guess is > that this is an intentional change in the 4.5.x, and we need to get on board. Probably. I've asked on the ticket.
MDN Web Docs' bug reporting has now moved to GitHub. From now on, please file content bugs at https://github.com/mdn/sprints/issues/ and platform bugs at https://github.com/mdn/kuma/issues/.
Status: REOPENED → RESOLVED
Closed: 9 years ago5 years ago
Resolution: --- → WONTFIX
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.