Opened 8 years ago

Last modified 7 years ago

#14250 confirmed Bug

Block Styles are not copied to new line

Reported by: Lynn Robinson Owned by:
Priority: Normal Milestone:
Component: General Version: 4.5.0
Keywords: Cc:

Description (last modified by Jakub Ś)

Steps to reproduce

  1. Apply a style to a single line of text in the full editor using the style combo dropdown
  2. Select all of the text again, and copy (ctrl-c).
  3. Position cursor at the end of the text and press return to create a new line. Now Paste (ctrl-p). The style formatting is not retained in the pasted text.

(However, if you copy/paste multiple lines, the bug does not happen, the style is successfully retained.)

Expected result

The pasted line should retain the style

Actual result

The pasted line does not retain the style

Other details (browser, OS, CKEditor version, installed plugins)

Happens in your demo, even in your 10/7/15 nightly build:

Bug happens in multiple browsers: Firefox, IE, and Google Chrome


  1. Open default sample and clear editor contents with "New Page" button
  2. Type 'Test', select it with mouse and select "Italic Title" block style from Styles dropdown
  3. Copy selected text with Ctrl+C
  4. Click next to selected text to unmark selection and press enter to move to new line
  5. Paste copied content into editor

Result: Simple paragraph instead of styled Header is pasted.

NOTES: Block Styles were copied till CKEditor version 4.4.8

Attachments (1)

working.png (27.5 KB) - added by Jakub Ś 8 years ago.

Download all attachments as: .zip

Change History (5)

Changed 8 years ago by Jakub Ś

Attachment: working.png added

comment:1 Changed 8 years ago by Jakub Ś

Status: newpending
Version: 4.5.4

I could not reproduce this issue in any browser in CKEditor 4.5.6.

From what I understand it is enough to create line of text, style it, copy it and paste it into new line. This TC seems to work fine. I have even unfocused newly created line and focused it again so that the empty inline style in that new line is lost but still the pasted line was styled. Please see attached image.

Have I missed anything?

comment:2 Changed 8 years ago by Lynn Robinson

I confirmed the bug is still happening (I just tried it using Chrome 47 and Firefox 43 using your demo page today January 28, 2016.

I'll give more detailed instructions to help you recreate this: (Especially make sure that you are selecting a non-inline style.)

1) Go to your demo page (which is version 4.5.6)

2) Scroll down near the end of the text and put your cursor at the end of the line after the text 'landed in the Pacific Ocean on July 24.'

3) Hit <return key> to create a new line/paragraph.

4) Type the word 'Test'

5) Select/highlight the word you just typed (Test) with the mouse and use the toolbar 'Styles' dropdown list to select Italic Title style (or any non-inline style).

6) With this word (Test) still selected (now in italic), type Cntl-C to copy the word. (Ensure that before doing Cntl-C, only this word is selected.)

7) Hit <return key> to create a new line/paragraph.

8) Hit Cntl-V to paste the word

9) Notice the pasted word has lost its italic style.

10) Try the same experiment but this time select and copy multiple lines, and the bug does not happen, the style is retained.

The bug only happens with some of the (block type) Styles such as Italic Text, Subtitle, and Special Container. The problem does not happen with Inline styles such as Marker style. If you select and copy an entire line (e.g. try it with 'This is a test.'), the user would naturally expect a block style to be retained when you copy it, it should not just work for Inline styles.

If you still cannot reproduce it, please ask a teammate to try also, maybe you are doing something slightly different than the instructions above. Thanks,Lynn

comment:3 Changed 8 years ago by Jakub Ś

Description: modified (diff)
Status: pendingconfirmed
Summary: copying and pasting a single line of text onto a new line does not retain the styleBlock Styles are not copied to new line
Version: 4.5.0

Problem can be reproduced from CKEditor 4.5.0 in all browsers.

To work around the problem you can select your styled element by clicking on it in elements path. For example for "Italic title", clicking on H2 in elements path seems to select whole element and such copied content gets pasted properly.

comment:4 Changed 8 years ago by Jakub Ś

It turns out we have quite a few issues with pasting and they all may be related as they all can be reproduced from 4.5.0:
Styles Stripping: #13860, #13926, #14250, #14358
Styles stripping on Chrome in various test cases: #14921, #14593, #13753, #13751, #16454
ForcePasteAsPlainText pastes formatted HTML with Ctrl+V: #13969 Weird event pasting relation (not sure): #13763
White spaces not preserved: #14614
Problem with pasting in LibreOffice: #14622 (we do not support it but I have added this issue because general solution might also bring back old behaviour).

Version 4, edited 7 years ago by Jakub Ś (previous) (next) (diff)
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