Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#9194 closed Bug (invalid)

stylesheetparser, using Generic Class defined in stylesheet, generic classes broken in Styles Dropdown

Reported by: JDub Owned by:
Priority: Normal Milestone:
Component: Core : Styles Version:
Keywords: Cc: jw@…

Description

I understand the stylesheetparser is designed to only work with classes assigned to elements.

Example;

div.normalText { ... }

OR;

span.normalText { ... }

However, I would like to use Generic Classes...

Example;

.normalText { ... }

The following code populates the styles dropdown with "generic" classes defined in an external stylesheet;

$('#myTextarea').ckeditor({
    extraPlugins:'stylesheetparser',
    stylesheetParser_skipSelectors:/(^body\.)/i,
    stylesheetParser_validSelectors:/\.\w+/,
    contentsCss:'/css/styles.css',
    stylesSet:[],
    toolbar:[['Bold','Italic','Underline','-','Styles','FontSize']]
});

The Problem is that generic classes show up as broken in the Styles Dropdown. It shows the following format for each Dropdown Item;

< class="normalText">.normalText</>

See attached Image

I tried to edit the source and fix myself, but honestly I'm lost :)

I understand what is happening, it is using the element to generate the html in the dropdown... In this case the element is empty, thus the broken html tag above... My recommended solution is to use a <span> in the dropdown list when the element is empty.

Can this simple fix be added to the next release of ckeditor?

(It is very important to me that Generic classes be supported)

Thanks!

Attachments (1)

styles-dropdown.JPG (20.7 KB) - added by JDub 7 years ago.
Styles Dropdown broken when using generic class

Download all attachments as: .zip

Change History (4)

Changed 7 years ago by JDub

Attachment: styles-dropdown.JPG added

Styles Dropdown broken when using generic class

comment:1 Changed 7 years ago by Jakub Ś

Keywords: stylesheetparser contentsCss stylesheetParser_skipSelectors stylesheetParser_validSelectors external stylesheet generic class generic selector styles dropdown styles combobox styles select box rich combo removed

comment:2 Changed 7 years ago by Jakub Ś

Resolution: invalid
Status: newclosed
Version: 3.6.5 (SVN - trunk)

CKEditor requires style to be bounded to a particular element. Currently there is no support for applying an arbitrary class as style to a random set of elements.

comment:3 Changed 7 years ago by JDub

Can we change this to a feature request then?

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