I’m working with ckeditor, and using the stylesheetparser to load styles from a fairly long stylesheet. It works, but I can’t get it to work visually the way i want it to: the styles dropdown applies each style’s definition to the display of the style name; i want these to be plain text. Specifically, some styles have large top or bottom margins, which leaves giant gaps in the drop-down content.
I cloned the stylesheetparser plugin.js source, and tried modifying the code where it pushes the parsed styles onto the styles list. I can successfully change the name, but not the way the name displays in the list. If i change the class attribute in this code (shown below), it changes the actual style definition, not just the style used to display it in the dropdown.
// Add each style to our "Styles" collection.
for ( i = 0; i < aClasses.length; i++ )
{
var oElement = aClasses[ i ].split( '.' ),
element = oElement[ 0 ].toLowerCase(),
sClassName = oElement[ 1 ];
styles.push( {
name : element + '.' + sClassName,
element : element,
attributes : {'class' : sClassName}
});
}
Does anyone know how to change the style used to display styles in the dropdown?
To change that you must work on the stylescombo plugin, not on the stylesheet parser as that just fills the Styles, but it’s the combo the one that shows them.