Opened 11 years ago

Last modified 11 years ago

#10372 confirmed New Feature

Paste as plain text do not work

Reported by: ST-bobr Owned by:
Priority: Normal Milestone:
Component: Core : Pasting Version: 4.0
Keywords: Cc:

Description

The bug is reproducible at the demo page: http://ckeditor.com/demo#full.

Copy any <br>-splitted text to clipboard. I use text from the thunderbird mail client. The source code of an email shows something like this:

<br/>
  TEXTTEXT  TEXTTEXT  TEXTTEXT  TEXTTEXT<br/>
<br/>
  TEXTTEXT  TEXTTEXT  TEXTTEXT  TEXTTEXT  TEXTTEXT<br/>
<br/>
<br/>

So when I copy the text to the clipboard(not the source code). When I paste it to CKEditor with Ctrl + V, and open source code, i see the same <br> formatting.

When I use Ctrl + Shift + V to paste the text, the source code shows <p>-formatted:

<p>
  TEXTTEXT  TEXTTEXT  TEXTTEXT  TEXTTEXT
</p>
<p>
  TEXTTEXT  TEXTTEXT  TEXTTEXT  TEXTTEXT  TEXTTEXT
</p>

So I expect the button "Paste as plain text" and pastetext plugin would work the same way, but it looks like it doesn't.

I tried to set config.forcePasteAsPlainText = true; but the behaviour is the same.

I allowed javascript to access the clipboard, but the "Paste as plain text" button works the same way as regular Paste button.

I expected that setting forcePasteAsPlainText to true will force Ctrl + V to work like Ctrl + Shift + V, but it doesn't.

We use latest CKEditor release 4.1.1.

Tested at Latest FF, Chrome and Opera.

Change History (1)

comment:1 Changed 11 years ago by Piotrek Koszuliński

Keywords: paste plain text removed
Status: newconfirmed
Type: BugNew Feature
Version: 4.1.1 (GitHub - master)4.0

First of all - Thunderbird is not a plain text editor as you know. It produces HTML and puts HTML into the clipboard. This makes a huge difference - it is not a browser who turns plain text into HTML when pasting, but it is already an HTML. Unless you force a browser to take plain text version of what is inside clipboard and paste it (CTRL+SHIFT+V).

The thing is that we discover browser's specific HTML which is produced for plain text (when real plain text is pasted or by CTRL+SHIFT+V) and then turns this into beautiful paragraph based HTML.

E.g. for this plain text:

foo

bar
bom

Webkits will generate:

<div>foo</div><div><br></div><div>bar</div><div>bom</div>

And we will then turn this into:

<p>foo</p><p>bar<br>bom</p>

Although, we don't want to do this for HTML which looks a little bit like plain text, but was not really created by specific browser from plain text. This could ruin someone's HTML which would be incorrectly recognized to be "plaintextified".

And the last case - when pasting HTML consisting only of text+brs with forcePasteAsPlainText option turned on. Why isn't paragraph based HTML produced? Because this option has a different meaning. It will turn even very complex HTML into bunch of paragraphs and brs, but if it finds just brs it won't do anything.

Of course, we could do more - if we simplified complex HTML we can turn it into paragraph based HTML at the end. However, thanks to Advanced Content Filter forcePasteAsPlainText starts to be needless, so it's rather unlikely that we'll work on improving it. In fact, the pastetext plugin was recently removed from basic preset because of ACF.

I'll leave this ticket, but a) as a new feature request, b) unlikely to be implemented.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy