Ticket #7784: 7784_3.patch
File 7784_3.patch, 1.9 KB (added by , 13 years ago) |
---|
-
_source/plugins/stylesheetparser/plugin.js
92 92 // Register a plugin named "stylesheetparser". 93 93 CKEDITOR.plugins.add( 'stylesheetparser', 94 94 { 95 init : function( editor ) 95 requires: [ 'styles' ], 96 onLoad : function() 96 97 { 97 editor.on( 'mode', function( e ) 98 var obj = CKEDITOR.editor.prototype; 99 obj.getStylesSet = CKEDITOR.tools.override( obj.getStylesSet, function( org ) 98 100 { 99 if ( editor.mode != 'wysiwyg' ) 100 return; 101 102 // Do this only once 103 e.removeListener(); 104 105 editor.getStylesSet( function( stylesDefinitions ) 106 { 107 // Rules that must be skipped 108 var skipSelectors = editor.config.stylesheetParser_skipSelectors || ( /(^body\.|^\.)/i ), 101 return function( callback ) 102 { 103 var self = this; 104 org.call( this, function( definitions ) 105 { 106 // Rules that must be skipped 107 var skipSelectors = self.config.stylesheetParser_skipSelectors || ( /(^body\.|^\.)/i ), 109 108 // Rules that are valid 110 validSelectors = editor.config.stylesheetParser_validSelectors || ( /\w+\.\w+/ );109 validSelectors = self.config.stylesheetParser_validSelectors || ( /\w+\.\w+/ ); 111 110 112 // Add the styles found in the document 113 editor._.stylesDefinitions = stylesDefinitions.concat( LoadStylesCSS( editor.document.$, skipSelectors, validSelectors ) ); 114 115 // Refresh the styles combo 116 var combo = editor.ui._.items[ 'Styles' ]; 117 combo && combo.args[ 0 ].reset(); 118 } ); 111 callback( ( self._.stylesDefinitions = definitions.concat( LoadStylesCSS( self.document.$, skipSelectors, validSelectors ) ) ) ); 112 }); 113 }; 119 114 }); 120 115 121 116 }