Ticket #8908 (closed Bug: invalid)

Opened 2 years ago

Last modified 2 years ago

Content pasted using 'Paste as Plain text' is sometimes styled in the editor.

Reported by: tmonahan Owned by:
Priority: Normal Milestone:
Component: Core : Pasting Version: 3.5
Keywords: IBM Cc: damo, satya

Description

To reproduce:

  • Open the replacebyclass sample and place the cursor between the words 'sample' and 'text'. Note that these words have a bold styling applied.
  • Open the 'Paste as plain text' dialog and type some content.
  • Click Ok.

Problem: The content that is inserted through the 'Paste as plain text' dialog also has the bold styling applied. It should not have any styling.

This occurs in CKEditor since 3.5. In rev 6232 the text is correctly inserted with no styling. However from rev 6241 the pasted content has styling applied.

Change History

comment:1 Changed 2 years ago by j.swiderski

  • Status changed from new to confirmed
  • Version changed from 3.6.4 (SVN - trunk) to 3.5

Having in ming of what was written in https://dev.ckeditor.com/ticket/7796#comment:4

"Paste as Plain Text" means that no formatting will be taken in consideration from the source data, having just text coming from it.
Pasting is contextual. It means that it will fit the styles of the context it is being pasted on. If we "reset" the styles, we'll be changing the format for that specific context.
Keep in mind that HTML content is contextual, by design. If you take text produced with the editor and inject it into a <b> tag in a front-end static page, the entire contents will be bold.


I thought that text is simply inserted into <strong> tags and thus it's getting bold but it turned out that new text splits existing <strong> tag and is wrapped in new one producing:

<strong>sa</strong><strong>test</strong><strong>mple text</strong>

The above is definitely wrong. The result should be either:

  1. <strong>satestmple text</strong>
    

or (It was working that way till CKEditor 3.4.3)

  1. <strong>sa</strong>test<strong>mple text</strong>
    

First concept is ok with contextual pasting while second was used in older versions of CKE.

comment:2 follow-up: ↓ 4 Changed 2 years ago by fredck

  • Status changed from confirmed to closed
  • Resolution set to invalid
  • Component changed from General to Core : Pasting

This is by design.

Our assumption is that Paste as Plain Text doesn't bring any style from the source, being contextual on the target. This reflects the "Keep text only" or "Paste as Unformatted Text" feature in MS Word.

comment:3 Changed 2 years ago by tmonahan

Contextual pasting does seem to be the standard across other applications so we are ok with closing this. It is a big change from the editor's previous behavior though.

Having said that, we agree with http://dev.ckeditor.com/ticket/8908#comment:1. Rather than producing:

<strong>sa</strong><strong>test</strong><strong>mple text</strong>

the editor should produce:

<strong>satestmple text</strong>

for this type of content. Can you please reopen this ticket to address this?

comment:4 in reply to: ↑ 2 Changed 2 years ago by tmonahan

Replying to fredck:

This is by design.

Our assumption is that Paste as Plain Text doesn't bring any style from the source, being contextual on the target. This reflects the "Keep text only" or "Paste as Unformatted Text" feature in MS Word.


Contextual pasting does seem to be the standard across other applications so we are ok with closing this. It is a big change from the editor's previous behavior though.

Having said that, we agree with http://dev.ckeditor.com/ticket/8908#comment:1. Rather than producing:

<strong>sa</strong><strong>test</strong><strong>mple text</strong>

the editor should produce:

<strong>satestmple text</strong>

for this type of content. Can you please reopen this ticket to address this?

comment:5 Changed 2 years ago by fredck

The elements merging is a different issue and I would ask you to please open a dedicated ticket for it. Thanks!

Note: See TracTickets for help on using tickets.
© 2003 – 2012 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy