Opened 4 years ago

Last modified 9 months ago

#10924 confirmed Bug

Attributes and styles are stripped from block elements when they are pasted in the editor

Reported by: Teresa Monahan Owned by:
Priority: Normal Milestone:
Component: General Version: 4.0 Beta
Keywords: IBM Cc: Satya Minnekanti, Irina

Description

To Reproduce:

  1. Place the following in the Source view of the editor. This is just a styled div containing some text:
    <div name="styledDiv" style="padding-bottom: 4px; background-color: rgb(255,255,204); margin: 8px; padding-left: 4px; padding-right: 4px; padding-top: 4px; border-radius: 6px">Sample text inside a styled Div</div>
    
  2. Switch back to wysiwyg mode and click on the editor contents.
  3. Select the div in the elementspath bar and use Ctrl+C to copy it.
  4. Insert a paragraph below the div using the magicline feature.
  5. Paste the div from your clipboard using Ctrl+V

Problems:

  • In FF, the div has been converted to a paragraph element and all attributes and styling have been removed.
  • In Chrome, the div has been converted to a paragraph element and all attributes and styling except the background color have been removed.
  • This usecase works well in IE.

Scenario 2:

  1. Clear the editor contents and repeat steps 1-4 above.
  2. Enter some text into the new paragraph created in step 4 above and press enter.
  3. Paste the div contents from your clipboard again.

Problems:

  • In IE, the div has been converted to a paragraph element and all attributes and styling have been removed.
  • In Chrome, the div has been converted to a paragraph element and all attributes and styling except the background color have been removed.
  • This usecase works well in FF.

Note: The name attribute in the sample code provided will always be removed when ACF is enabled. However, the same results as outlined above also occur even when ACF is disabled.

Change History (4)

comment:1 Changed 4 years ago by Jakub Ś

Status: newconfirmed
Version: 4.2.2 (GitHub - master)4.0 Beta

Problems can be reproduced from CKEditor 4.0 beta. This doesn't happen in editor 3.x.

<div name="styledDiv" style="padding: 4px; background-color: rgb(255, 255, 204); margin: 8px; border-top-left-radius: 6px; border-top-right-radius: 6px; border-bottom-right-radius: 6px; border-bottom-left-radius: 6px;">Sample text inside a styled Div</div> }}}

Last edited 21 months ago by Jakub Ś (previous) (diff)

comment:2 Changed 2 years ago by Anna Tomanek

Summary: Attributes and styles are stripped from div elements when they are pasted in the editorAttributes and styles are stripped from block elements when they are pasted in the editor

comment:3 Changed 2 years ago by Piotrek Koszuliński

DUP was reported in #10969.

comment:4 Changed 12 months ago by Jakub Ś

It seems we have quite a few issues with copy/paste and style loss - #14391, #14406, #10924.

Last edited 9 months ago by Jakub Ś (previous) (diff)
Note: See TracTickets for help on using tickets.
© 2003 – 2017 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy