VisualEditor: Preserve rich text formatting when pasting from internal or external sources (tracking)
Closed, ResolvedPublic0 Story Points


No matter the text is copied from an external source of another part of the document.

Version: unspecified
Severity: enhancement

liangent created this task.Dec 14 2011, 2:41 PM

Right now we only support plain text copy and paste. Rich text copy and paste within the document will be supported next, and eventually rich text paste from content copied outside the document will be supported where possible.

brion added a comment.Dec 14 2011, 7:22 PM

Tweaking title to clarify for enhancement request, so this'll look nice in the tracker. :)

Confirmed still a missing feature in current version. :-)

orbit wrote:

When copying one portion of the article and pasting into the same article, rich text pasting IS supported. Copying from an external source (another article or another application), only plain text pasting is supported.

@liangent, what platform/browser/version/method are you using to copy and paste? Very specific instructions would be helpful.

orbit wrote:

Oops, James just pointed out to me that this bug was originally filed against the December demo that used a very different copy/paste mechanism. For now, I'm leaving this open as an enhancement to fully support rich text copy and paste from external sources.

Mass-moving items into VisualEditor product

Mass-move out of "General" to "ContentEditable".

orbit wrote:

With this change:
rich copying and pasting from other ve instances (same wiki, same browser) is supported. I've changed the title to only indicate the feature request for rich copy and paste from external sources (other websites, Microsoft Word, etc).

orbit wrote:

Due to added complexity to the Linear Model in the last 6 months, the previously-supported copy and paste from separate ve instances is no longer supported as we work toward a universal solution.

  • Bug 37860 has been marked as a duplicate of this bug. ***
  • Bug 50946 has been marked as a duplicate of this bug. ***
  • Bug 50283 has been marked as a duplicate of this bug. ***
  • Bug 50401 has been marked as a duplicate of this bug. ***
  • Bug 50282 has been marked as a duplicate of this bug. ***
  • Bug 51220 has been marked as a duplicate of this bug. ***

Since 51220 has been marked as a duplicate, i figure it might be useful to respond here - especially since this bug has been open for a while.

At the moment it would seem that it is impossible to rearrange or move a section in the visual editor if that section contains an image inside it. Drag and Drop is not supported as of yet, and copy / cut and pasting of such as section results in the removal of all wikisyntax (And the image) from that section.

Images themselves are often present in the middle of a section so this issue is common. At the same time the article's that receive most traffic are the most likely to suffer from this issue (If we assume that the best quality article's tend to be the ones most commonly visited).

Is it supposed to be working for cut and paste inside a single article?

I've had variable results trying to rearrange sections in
in particular the subsections of Software support. Sometimes it works fine other times it loses formatting and references.

Steps to reproduce:

  1. Edit this revision:

  1. Scroll down to Software support
  2. Make a couple of blank lines above "Editors"
  3. Select the whole of the Web browsers section. When selecting ensure the selection is a complete rectangle going all the way to the right hand border.
  4. Copy and paste above Editors

If instead selecting a rectangular region the selection goes to the last character on the last line, the copy and paste seems to work fine.

  • Bug 52091 has been marked as a duplicate of this bug. ***
  • Bug 37860 has been marked as a duplicate of this bug. ***

Another example discussed at existing bulleted lists

THe bug occurred in editing [[en:Education in the United States#Electives]], all styling and links are lost

To reproduce the error reliably:
edit any bullet list immediately preceding a section header with the visual editor.

  1. Bring the cursor to the beginning of the last bullet.
  2. Holding down the CTRL-key, press the down-cursor key, thereby selecting the entire line plus some part of the following header.
  3. Still holding down the CTRL-key, press the left-cursor key just until the header letters no longer appear as selected.
  4. Cut the selected text and paste it in front of an earlier bullet point (or, probably, anywhere else in the article). Weird results ensue.

Incidentally, as soon as the text is cut, the up-cursor button is disabled.
I believe that the following line's header formatting codes are actually selected but the user cannot see this. Microsoft Word has similar buggy behavior.

I can reproduce the same on chrome on a mac, with shift and arrow keys.

I am noticing that in latest Mac/Chrome, in-article formatting is preserved when copying or cutting and pasting. However in latest Mac/Firefox all formatting is being stripped. Is that issue within the scope of this ticket, or should I open another?

(In reply to comment #22)

I am noticing that in latest Mac/Chrome, in-article formatting is preserved
when copying or cutting and pasting. However in latest Mac/Firefox all
formatting is being stripped. Is that issue within the scope of this ticket,
should I open another?

Please open another (though I can't reproduce locally - both Chrome and Firefox work the same for me).

Qgil added a comment.Oct 15 2013, 5:58 AM

Does this "rich formatting" include references and other VisualEditor artifacts?

Use case:

An editor is translating an article from to Opens both pages with VisualEditor, copies the content from and pastes it to

@Quim, good question. The current implementation we're working on will let you copy cross wiki with no questions asked, but as you point out, if the template or image doesn't exist on the other wiki you going to have a Bad Time.

We'll need to think about how we sanitise the data or warn the user when copy-pasting cross wiki.

Re-prioritising down, as the main work is now complete.

Jdforrester-WMF removed blocking tasks: T60419: VisualEditor: Copying a template from one page to another: render is correct, but template is gone., T60389: VisualEditor: Clouds are added at the end of a paste, T60387: VisualEditor: Templated tables seem to fail in copy paste, T60388: VisualEditor: Pasting a syntaxhighlight block from another VE surface don't load syntaxhighlight's styling, T60383: VisualEditor: Pasting a template throws undefined getModel error, T60384: VisualEditor: Copying a section throws undefined error, T60379: VisualEditor: undefined error during copy, T60318: VisualEditor: Pasting a table with a caption breaks fixUpInsertion, T60241: VisualEditor: Template is getting pasted as a table while doing copy-paste, T53538: VisualEditor: Reverse selections break copy paste functionality, T56728: VisualEditor: Copying a heading's text doesn't copy its format (unless the entire node is copied), T56721: VisualEditor: Header formatting is stripped when copying (or cutting) and pasting inside a single article in Firefox, T54771: VisualEditor: Pasting block level elements can lose annotations, T51396: VisualEditor: Can't copy/paste a reference or template unless you select text either side, T56410: VisualEditor: [Regression] Copy/paste of existing templates and images broken (unformatted text pasted only), T56262: Parsoid: mw:Entity not preserved if data-parsoid missing, T54271: VisualEditor: Editing a pasted template alters copy buffer. Displayed result differs from saved result., T54102: VisualEditor: Write newFromDocumentReplace so editing document slices is simple, T54096: VisualEditor: Copying between editors with wikitext-irrelevant CRs pastes the ↵ as a literal character, not a CE newline placeholder, T54091: The read HTML should have hinting to allow full DOM copying (as opposed to just rich copying) from read mode into VE surfaces, T50720: VisualEditor: Paste of content does not use the context's annotation, T55828: VisualEditor: Pasting text into VE from external text processor removes newlines, T55781: VisualEditor: Insert external pasted content as "unformatted" if Ctrl+/Cmd+Shift+V rather than Ctrl+/Cmd+V trigger, T52128: VisualEditor: HTML comment not removed from user pasting (? from external source), T52126: VisualEditor: Can't copy/paste header from start of document without losing formatting, T53725: VisualEditor: Rich content copied from sub-documents (image captions, references, etc.) down-cast to plain text when the sub-document is closed, T50172: VisualEditor: Throttle or otherwise handle large copy-paste input, T50170: VisualEditor: Support pasting of HTML from external sources, T43193: VisualEditor: Support copy and paste from other VE instances (surfaces), T39932: VisualEditor: Upload-by-insertion of images via copy-paste.Dec 3 2014, 1:28 AM
Jdforrester-WMF closed this task as "Resolved".
Jdforrester-WMF claimed this task.

Now tracked in VisualEditor-CopyPaste instead.

Jdforrester-WMF edited a custom field.

Add Comment