Ticket #5290: 5290.patch
File 5290.patch, 5.5 KB (added by , 14 years ago) |
---|
-
_source/plugins/div/dialogs/div.js
436 436 437 437 // Preparing for the 'elementStyle' field. 438 438 var dialog = this, 439 stylesField = this.getContentElement( 'info', 'elementStyle' ), 440 // Reuse the 'stylescombo' plugin's styles definition. 441 customStylesConfig = editor.config.stylesCombo_stylesSet, 442 stylesSetName = customStylesConfig && customStylesConfig.split( ':' )[ 0 ]; 439 stylesField = this.getContentElement( 'info', 'elementStyle' ); 443 440 444 if ( stylesSetName ) 441 // Reuse the 'stylescombo' plugin's styles definition. 442 editor.getStylesSet && editor.getStylesSet( function( stylesDefinitions ) 445 443 { 446 CKEDITOR.stylesSet.load( stylesSetName, 447 function( stylesSet ) 448 { 449 var stylesDefinitions = stylesSet[ stylesSetName ], 450 styleName; 444 var styleName; 451 445 452 if ( stylesDefinitions ) 446 if ( stylesDefinitions ) 447 { 448 // Digg only those styles that apply to 'div'. 449 for ( var i = 0 ; i < stylesDefinitions.length ; i++ ) 450 { 451 var styleDefinition = stylesDefinitions[ i ]; 452 if ( styleDefinition.element && styleDefinition.element == 'div' ) 453 453 { 454 // Digg only those styles that apply to 'div'. 455 for ( var i = 0 ; i < stylesDefinitions.length ; i++ ) 456 { 457 var styleDefinition = stylesDefinitions[ i ]; 458 if ( styleDefinition.element && styleDefinition.element == 'div' ) 459 { 460 styleName = styleDefinition.name; 461 styles[ styleName ] = new CKEDITOR.style( styleDefinition ); 454 styleName = styleDefinition.name; 455 styles[ styleName ] = new CKEDITOR.style( styleDefinition ); 462 456 463 // Populate the styles field options with style name. 464 stylesField.items.push( [ styleName, styleName ] ); 465 stylesField.add( styleName, styleName ); 466 } 467 } 457 // Populate the styles field options with style name. 458 stylesField.items.push( [ styleName, styleName ] ); 459 stylesField.add( styleName, styleName ); 468 460 } 461 } 462 } 469 463 464 // We should disable the content element 465 // it if no options are available at all. 466 stylesField[ stylesField.items.length > 1 ? 'enable' : 'disable' ](); 470 467 471 // We should disable the content element 472 // it if no options are available at all. 473 stylesField[ stylesField.items.length > 1 ? 'enable' : 'disable' ](); 474 475 // Now setup the field value manually. 476 setTimeout( function() { stylesField.setup( dialog._element ); }, 0 ); 477 } ); 478 } 468 // Now setup the field value manually. 469 setTimeout( function() { stylesField.setup( dialog._element ); }, 0 ); 470 } ); 479 471 }, 480 472 onShow : function() 481 473 { -
_source/plugins/stylescombo/plugin.js
5 5 6 6 (function() 7 7 { 8 var stylesManager;9 10 8 CKEDITOR.plugins.add( 'stylescombo', 11 9 { 12 10 requires : [ 'richcombo', 'styles' ], … … 15 13 { 16 14 var config = editor.config, 17 15 lang = editor.lang.stylesCombo, 18 pluginPath = this.path,19 16 styles; 20 17 21 if ( !stylesManager )22 stylesManager = CKEDITOR.stylesSet;23 24 var comboStylesSet = config.stylesCombo_stylesSet.split( ':' ),25 styleSetName = comboStylesSet[ 0 ],26 externalPath = comboStylesSet[ 1 ];27 28 stylesManager.addExternal( styleSetName,29 externalPath ?30 comboStylesSet.slice( 1 ).join( ':' ) :31 pluginPath + 'styles/' + styleSetName + '.js', '' );32 33 18 editor.ui.addRichCombo( 'Styles', 34 19 { 35 20 label : lang.label, … … 47 32 { 48 33 var combo = this; 49 34 50 CKEDITOR.stylesSet.load( styleSetName, function( stylesSet)35 editor.getStylesSet( function( stylesDefinitions ) 51 36 { 52 var stylesDefinitions = stylesSet[ styleSetName ], 53 style, 37 var style, 54 38 styleName, 55 39 stylesList = []; 56 40 … … 260 244 })(); 261 245 262 246 /** 247 * Gets the current styleset for this instance 248 * @param {Function} The function to be called with the styles data. 249 * @example 250 * editor.getStylesSet( function( stylesDefinitions ) {} ); 251 */ 252 CKEDITOR.editor.prototype.getStylesSet = function( callback ) 253 { 254 if (!this._.stylesDefinitions) 255 { 256 var editor = this, 257 comboStylesSet = editor.config.stylesCombo_stylesSet.split( ':' ), 258 styleSetName = comboStylesSet[ 0 ], 259 externalPath = comboStylesSet[ 1 ], 260 pluginPath = CKEDITOR.plugins.registered.stylescombo.path; 261 262 CKEDITOR.stylesSet.addExternal( styleSetName, 263 externalPath ? 264 comboStylesSet.slice( 1 ).join( ':' ) : 265 pluginPath + 'styles/' + styleSetName + '.js', '' ); 266 267 268 CKEDITOR.stylesSet.load( styleSetName, function( stylesSet ) 269 { 270 editor._.stylesDefinitions = stylesSet[ styleSetName ]; 271 callback( editor._.stylesDefinitions ); 272 } ) ; 273 } 274 else 275 callback( this._.stylesDefinitions ); 276 }; 277 278 /** 263 279 * The "styles definition set" to load into the styles combo. The styles may 264 280 * be defined in the page containing the editor, or can be loaded on demand 265 281 * from an external file when opening the styles combo for the fist time. In