Comments in the CKEditor documenation and source code imply that it's possible to have some control over how styles are applied, including existing styles. E.g., from core/style.js line 667:
* The style handling job, which includes such tasks as applying,
* removing, checking state, and checking if a style can be
* applied, is very complex. Therefore without deep knowledge
* about DOM and especially {@link CKEDITOR.dom.range ranges} and
* {@link CKEDITOR.dom.walker DOM walker} it is impossible to
* implement a completely custom style handler able to handle
* block, inline, and object type styles. However, it is possible
* to customize the default implementation by overriding default
* methods and reusing them.
The last line leads me to think I should be able to modify what happens, for example, when the format plugin is used to apply a style change to convert text to an h1 heading using something like:
CKEDITOR.style.addCustomHandler({
element: 'h1',
type: 1,
apply: function( editor ) {
console.log( 'apply' );
},
remove: function( editor ) {
console.log( 'remove' );
}
});
But the above, and several variations on it (with different or omitted element and type attributes) has no effect.
I guess this is either not possible or I'm doing something wrong, but I don't know which. Any help would be greatly appreciated. Thanks!
(Note that I can see from the docs how to have a brand new style, created with a 'type' attribute and to modify it using addCustomHandler, but the format plugin creates its styles with the 'element' attribute not the 'type' attribute.)
Terry