Opened 14 years ago

Closed 12 years ago

#6026 closed Bug (duplicate)

Handling of elements with attributes in the style system

Reported by: Sa'ar Zac Elias Owned by:
Priority: Normal Milestone:
Component: General Version: 3.0
Keywords: Cc:

Description

The style system does not respect attributes on elements, as mentioned by Garry. IMHO we should respect other attributes to achieve the result that is expected by clients.
Let's say the loaded HTML is:

<strong class="redText">I'm a bolden red text</strong>

Now, say the user wants to unbold the text but still preserve the red color. He expects the editor to leave the class attribute.

Change History (9)

comment:1 Changed 14 years ago by Frederico Caldeira Knabben

I would love to hear this coming from a real world test case, so we can also understand how the user was able to create the <strong class="redText"> first.

Looks like a low-pri for me.

comment:2 Changed 13 years ago by Garry Yao

Actually it's quite common a case, e.g. <strong en="fr">rédacteur en chef</strong> make it unable to remove the bold style.

comment:3 Changed 13 years ago by Frederico Caldeira Knabben

Ok... now again... it's still unclear how the user put that lang in <strong> (I know they can use the style combo, but in the real real world a <span> is used for that)... real word (web links) examples is what we need, not theoretical cases.

comment:4 Changed 13 years ago by Wiktor Walc

#6400 was marked as duplicate - a strong element with an attribute appeared in CKEditor when user pasted the content (real world example).

comment:5 Changed 13 years ago by Jakub Ś

Status: newconfirmed
Version: 3.0

This is a very rare case, I haven't seen any of this. But I don't think it's impossible, there always can be a situation where code created by some external editor or user is injected in to editor.

Anyway despite whether we decide if strong tags with attributes should be changed to span or simply removed with attributes, there is a bug in CKEditor.


  1. Insert the following code <strong lang="en">sample text</strong>
  2. Place the cursor inside sample text and press bold button.

Result: It is impossible to unbold the text.

The same goes for underline, italic, strike, sub sup and other inline styles form Styles dropdown list that use tags different than span.

Issue has been reproducible from CKEditor 3.0.

comment:6 Changed 12 years ago by Jakub Ś

The same is for "em" and "u" tags

<p><em style="text-decoration: none; color: rgb(203, 32, 39); "><a href="
http://ckeditor.com/demo " target="_blank">Url to be modified</a> </em></p>

The above example was reported on our support channel.

I have checked this in latest CKEditor 3.6.2. It seems that "Remove Format" button can be used as a workaround to remove styled "u", "em", "strong".


There is one thing that some one might see as a bug with Remove Formatting button.

  1. Put collapse selection Url to be modi^fied and press remove formatting
  2. You will receive two links wrapped in two em elements
    <p>
    	<em style="text-decoration: none; color: rgb(203, 32, 39); "><a href="
    http://ckeditor.com/demo " target="_blank">Url to be mo</a></em><em style="text-decoration: none; color: rgb(203, 32, 39);"><a href="
    http://ckeditor.com/demo " target="_blank">dified</a> </em></p>
    
  3. Now select everything in editor and press "Remove Format". You will get two links
    <p>
    	<a href="
    http://ckeditor.com/demo " target="_blank">Url to be mo</a><a href="
    http://ckeditor.com/demo " target="_blank">dified</a></p>
    

User most likely would like this to be joined in one link but I believe this is expected behavoir as this is how "Remove Format" works. Removes formatting for current selection.

comment:7 Changed 12 years ago by Jakub Ś

IMO this issue is related to #8686

comment:8 Changed 12 years ago by Jakub Ś

#8678 was marked as duplicate.

comment:9 Changed 12 years ago by Jakub Ś

Keywords: Discussion removed
Resolution: duplicate
Status: confirmedclosed

I'm closing this one as duplicate of #8369 because in #8369 @mrfr0g has provided a patch.

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