Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#9754 closed Bug (fixed)

Cut/paste simple unformatted text generates inline wrapper in Webkits

Reported by: Ronald Owned by: Piotrek Koszuliński
Priority: Normal Milestone: CKEditor 4.0.1
Component: Core : Pasting Version: 4.0
Keywords: Webkit Cc:

Description

When I cut and paste a really simple piece of text within the CKEditor (that is, no MSWord or other source is being used), still additional formatting is added in Google Chrome.

Reproduction scenario in Google Chrome v23:

  • Enter the text 'Test'
  • Verify in the CODE view that your code is <p>Test</p>
  • Go back to wysiwyg view
  • Cut the letter 'e' using Ctrl+X
  • Paste it anywhere (eTst, Test, Tset, Tste)
  • Go to CODE view again; note that a <font> tag has been added. Ffor example: <p>T<span style="font-size: 13px;">e</span>st</p>

Expected behaviour (yep, I know Chrome makes this harder):

  • No additional formatting should be generated in general
  • Especially when cutting and pasting at the same position, the result should be the original text without changes

This bug is reproducable in nightly build demo (http://nightly.ckeditor.com/3998/samples/replacebyclass.html)

Change History (8)

comment:1 Changed 7 years ago by Jakub Ś

Keywords: Chrome added
Status: newconfirmed

This is Chrome only issue reproducible from CKEditor 4.0. It didn’t occur in 4 beta.

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

Keywords: Webkit added; Chrome removed
Milestone: CKEditor 4.0.1

You're right that Webkits (Safari and Chrome are affected) make this hard. In fact they make it impossible to find out if pasted styles should be stripped or kept by us. The only thing we can do is stripping everything and that is not a good solution, because styles applied by the user will be lost too ;|.

Fortunately I know that we haven't got this problem few weeks ago, so I was able to find first bad commit git:ad89556. We'll have to try to restyle editor or find better place for pastebin, so Webkit won't be applying styles which differ between origin and destination.

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

Summary: Cut/paste simple unformatted text generates <font> tag in ChromeCut/paste simple unformatted text generates inline wrapper in Webkits

comment:4 Changed 7 years ago by Piotrek Koszuliński

Owner: set to Piotrek Koszuliński
Status: confirmedreview

Pushed git:d8221c1 (t/9754).

To fix this issue we need to style pastebin like editable. To achieve that we can either add .cke_editable class to it or add #cke_pastebin to rule for .cke_editable in contents.css.

Second solution makes contents.css less clear and it mixes plugin's specific stuff into core. So the only decent way is the first one. It has only one flaw - specific editable's styles may break pastebin.

Last edited 7 years ago by Piotrek Koszuliński (previous) (diff)

comment:5 Changed 7 years ago by Olek Nowodziński

Rebased on latest master.

comment:6 Changed 7 years ago by Olek Nowodziński

Status: reviewreview_passed

comment:7 Changed 7 years ago by Piotrek Koszuliński

Resolution: fixed
Status: review_passedclosed

Masterised git:76f93c9.

comment:8 Changed 7 years ago by Ronald

Great, thanks!

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