Opened 9 years ago

Last modified 8 years ago

#13206 review Bug

Style is not visible if it uses multiple classes

Reported by: Lars Schultz Owned by: Tade0
Priority: Normal Milestone:
Component: Core : Styles Version: 4.3
Keywords: Cc:

Description

When the classes are not sorted alphabetically (in the string), it will not be made available because it is deemed not "applicable", because it does not pass the test in objectCompare(element.attributes,clone.attributes).

Example: a style in stylesset with the following definition: {name:'Multi Class', element:'p', attributes:{class:'c b a'}}

Will not be selectable from the combo because when a clone is created from the element and then compared, the compared class-string is ordered alphabetically 'a b c';

1652 core/filter.js/processElement/updateElement loops through all possible classnames and then sorts them on line 1658 classesArr.sort().join( ' ' );

140 stylescombo/plugin.js style.checkApplicable() 366 core/style.js checkApplicable/filter.check() 744 core/filter.js CKEDITOR.toosl.objectCompare()

thus the object comparison fails...

Change History (8)

comment:1 Changed 9 years ago by Jakub Ś

Keywords: stylescombo filter class removed
Status: newconfirmed
Version: 4.4.64.3

Problem can be reproduced from CKEditor 4.3 (works fine in 4.3 beta) in every browser.

comment:2 Changed 9 years ago by Jakub Ś

#12244 was marked as duplicate.

comment:3 Changed 9 years ago by Jakub Ś

#14510 was marked as duplicate.

comment:4 Changed 8 years ago by Jakub Ś

#14909 was marked as duplicate.

comment:5 Changed 8 years ago by Tade0

Owner: set to Tade0
Status: confirmedreview

Solved this by (non-invasively) sorting classes before comparison in filter.check().

Changes pushed to branch:t/13206.

comment:6 Changed 8 years ago by Tade0

Status: reviewassigned

Solved - or not. It's possible to apply the style multiple times and hence impossible to remove it.

comment:7 Changed 8 years ago by Tade0

Status: assignedreview

Different approach: Sort classes when creating the style.

Switching modes sorts the classes anyway, so let's just ensure that the classes are sorted once the style is created.

Changes pushed to branch:t/13206a.

comment:8 Changed 8 years ago by Jakub Ś

User has pointed out that these two issues #9349 and #9405 might be related to "sorted alphabetically" problem. Perhaps it would review the ticket based on them as well.

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