Page MenuHomePhabricator

On pasting single-line ContentBranchNodes (headings, <pre>s, blockquotes), convert them down to paragraphs rather than copying the formatting
Closed, ResolvedPublic1 Story Points

Description

Pasting an article title into the new wiki editor puts it into single equal marks.

I suspect that pasting an article title to create a link is a much more common scenario than pasting it to create an <H1> heading in the middle of an article.

Similar issue in VisualEditor: T72519: VisualEditor: Pasting of MediaWiki article title H1 should paste as a <p> instead of an <h1>.

Also somewhat related: T153247: a sun ☀ appeared after pasting an article title into new wikitext editor

Event Timeline

Amire80 created this task.Dec 14 2016, 9:05 PM
Restricted Application added a project: VisualEditor. · View Herald TranscriptDec 14 2016, 9:05 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

We could ignore <h1>s on paste, but we're not going to start magically creating links to random other contexts.

Ignoring would be enough. That's what I meant. No automatic link is needed.

This actually mirrors behaviour in VE - you can always force plain paste with ctrl+shift+v. We did consider always pasting plain in source mode, but OTOH being able to paste a table in source mode is a useful feature. We also considered popping-up a modal each time asking if they want plain or rich (when there's a difference) as is done in LibreOffice Calc, but that may be annoying.

We could also convert all one line ContentBranchNode pastes (headings, <pre>'s blockquotes) to paragraphs, in both VE and source mode. This already happens with internal copy/paste as the internal selection is completely inside the CBN node.

We could also convert all one line ContentBranchNode pastes (headings, <pre>'s blockquotes) to paragraphs, in both VE and source mode. This already happens with internal copy/paste as the internal selection is completely inside the CBN node.

That might be a good idea. I'm trying to think back over edits I've made in the past few years; in general single-line copies are for content, not styling, in my personal usage. It's plausible that that might work well in general. It might well be worth trying that out and seeing whether it results in more complaints than the current situation.

TheDJ added a subscriber: TheDJ.Dec 16 2016, 8:49 AM

Have we considered just inverting the paste behavior of plain text vs rich text pasting depending on the editor? I think the principal of least astonishment should guide us here, and for me that would mean plain text pasting in a plain text format, and we could have ctrl-shift-V for richt text pasting in the plain text editor.

Amire80 updated the task description. (Show Details)Dec 16 2016, 8:56 AM
Amire80 updated the task description. (Show Details)Dec 16 2016, 9:05 AM

Have we considered just inverting the paste behavior of plain text vs rich text pasting depending on the editor? I think the principal of least astonishment should guide us here, and for me that would mean plain text pasting in a plain text format, and we could have ctrl-shift-V for richt text pasting in the plain text editor.

It might be just me, but pasting article titles is by far the most frequent scenario in which text is auto-formatted not in the way that I want it to, and where I'd prefer to be pasted as plain text (or identically to the surrounding markup). That's what T72519 is about, and this new bug is very similar.

So I don't think a full reversal is needed, although it is a curious idea :)

Change 327774 had a related patch set uploaded (by Esanders):
Unwrap single pasted content branch nodes

https://gerrit.wikimedia.org/r/327774

Jdforrester-WMF renamed this task from Pasting an article title into the new wiki editor puts it into single equal marks to On pasting single-line ContentBranchNodes (headings, <pre>s, blockquotes), convert them down to paragraphs rather than copying the formatting.Dec 16 2016, 7:46 PM
Jdforrester-WMF assigned this task to Esanders.
Jdforrester-WMF triaged this task as Normal priority.
Jdforrester-WMF set the point value for this task to 1.
Jdforrester-WMF moved this task from To Triage to TR1: Releases on the VisualEditor board.

OK, retitling to what we're deciding to do (for clarity). Pasting any single line of content (like a heading or whatever) will now just paste the text, not the formatting.

Change 327774 merged by jenkins-bot:
Unwrap single pasted content branch nodes

https://gerrit.wikimedia.org/r/327774

Dvorapa added a subscriber: Dvorapa.Jan 1 2017, 4:09 PM

Change 330226 had a related patch set uploaded (by Jforrester):
Update VE core submodule to master (da4a0b5)

https://gerrit.wikimedia.org/r/330226

Change 330226 merged by jenkins-bot:
Update VE core submodule to master (da4a0b5)

https://gerrit.wikimedia.org/r/330226