The problem is not the stylesheet parser, but the fact that the Styles system in CKEditor is meant to be used with known elements, it doesn't allow to create a generic Style that can be applied to any element. So that little trick with the parser is useless, you need a far bigger change to do what you want.
But what I have so far works great! I mean, it applies the style to selected text in the editor just fine. The only issue is how it shows up in the dropdown box...
I can see exactly what is happening... it is using the defined element to create the html in the dropdown box... problem here is that there is no defined element.
I see a real easy fix, when no element is defined, use a span tag. This way the dropdown list will look correct.
That would have been generated if the class was really applied to the table.
But if the first option is what you want, you just have to modify your copy of the parser so that it always defaults to a span element, that way you'll get what you want on the dropdown and the output will be the same (but certainly that's not what most of the people would understand as using a generic class, you can just put the span on your stylesheet and get the same outcome)
Re: stylesheetparser using Generic CSS class
So that little trick with the parser is useless, you need a far bigger change to do what you want.
Re: stylesheetparser using Generic CSS class
But what I have so far works great! I mean, it applies the style to selected text in the editor just fine. The only issue is how it shows up in the dropdown box...
I can see exactly what is happening... it is using the defined element to create the html in the dropdown box... problem here is that there is no defined element.
I see a real easy fix, when no element is defined, use a span tag. This way the dropdown list will look correct.
Thoughts?
Re: stylesheetparser using Generic CSS class
For example if I start with a table and then I select it and try to apply such style this is what I get:
instead of
That would have been generated if the class was really applied to the table.
But if the first option is what you want, you just have to modify your copy of the parser so that it always defaults to a span element, that way you'll get what you want on the dropdown and the output will be the same (but certainly that's not what most of the people would understand as using a generic class, you can just put the span on your stylesheet and get the same outcome)