Ticket #4973: 4973.patch
File 4973.patch, 6.5 KB (added by , 13 years ago) |
---|
-
_source/plugins/stylescombo/plugin.js
32 32 33 33 init : function() 34 34 { 35 var combo = this, 36 stylesSet = config.stylesCombo_stylesSet.split( ':' ); 35 var combo = this; 37 36 38 var stylesSetPath = stylesSet[ 1 ] ? 39 stylesSet.slice( 1 ).join( ':' ) : // #4481 40 CKEDITOR.getUrl( pluginPath + 'styles/' + stylesSet[ 0 ] + '.js' ) ; 41 42 stylesSet = stylesSet[ 0 ]; 43 44 CKEDITOR.loadStylesSet( stylesSet, stylesSetPath, function( stylesDefinitions ) 37 CKEDITOR.stylesSet.load( styleSetName, function( stylesSet ) 45 38 { 46 var style, 39 var stylesDefinitions = stylesSet[ styleSetName ], 40 style, 47 41 styleName, 48 42 stylesList = []; 49 43 … … 204 198 this.hideGroup( lang[ 'panelTitle' + String( CKEDITOR.STYLE_OBJECT ) ] ); 205 199 } 206 200 }); 207 }208 });209 201 210 var stylesSets = {}; 202 var stylesSet = config.stylesCombo_stylesSet.split( ':' ), 203 styleSetName = stylesSet[ 0 ], 204 externalPath = stylesSet[ 1 ]; 211 205 212 CKEDITOR.addStylesSet = function( name, styles ) 213 { 214 stylesSets[ name ] = styles; 215 }; 206 CKEDITOR.stylesSet.addExternal( styleSetName, 207 externalPath ? stylesSet.slice( 1 ).join( ':' ) : pluginPath + 'styles/', 208 externalPath ? '' : styleSetName + '.js' ); 216 209 217 CKEDITOR.loadStylesSet = function( name, url, callback )218 {219 var stylesSet = stylesSets[ name ];220 221 if ( stylesSet )222 {223 callback( stylesSet );224 return ;225 210 } 226 227 CKEDITOR.scriptLoader.load( url, function() 228 { 229 callback( stylesSets[ name ] ); 230 }); 231 }; 211 }); 232 212 213 // Custom stylesSets as global resources. 214 CKEDITOR.stylesSet = new CKEDITOR.resourceManager( '', 'stylesSet' ); 215 233 216 function buildPreview( styleDefinition ) 234 217 { 235 218 var html = []; -
_source/plugins/stylescombo/styles/default.js
3 3 For licensing, see LICENSE.html or http://ckeditor.com/license 4 4 */ 5 5 6 CKEDITOR. addStylesSet( 'default',6 CKEDITOR.stylesSet.add( 'default', 7 7 [ 8 8 /* Block Styles */ 9 9 -
_source/plugins/div/dialogs/div.js
259 259 return groups; 260 260 } 261 261 262 // Registered 'CKEDITOR.style' instances. 263 var styles = {} ; 262 264 /** 263 265 * Hold a collection of created block container elements. 264 266 */ … … 292 294 items : [], 293 295 setup : function( element ) 294 296 { 295 this.setValue( element.$.style.cssText || '' ); 297 for ( var name in styles ) 298 styles[ name ].checkElementRemovable( element, true ) && this.setValue( name ); 296 299 }, 297 300 commit: function( element ) 298 301 { 299 if ( this.getValue() ) 300 element.$.style.cssText = this.getValue(); 301 else 302 element.removeAttribute( 'style' ); 302 var styleName; 303 if ( styleName = this.getValue() ) 304 styles[ styleName ].applyToObject( element ) 303 305 } 304 306 }, 305 307 { … … 351 353 id :'style', 352 354 style :'width: 100%;', 353 355 label :editor.lang.common.cssStyle, 354 'default' : '' 355 } 356 'default' : '', 357 commit : function( element ) 358 { 359 var style = element.$.style; 360 // Element styles are of higher priority. 361 style.cssText = this.getValue() + ';' + style.cssText; 362 } 363 } 356 364 ] 357 365 }, 358 366 { … … 376 384 'default' : '', 377 385 items : 378 386 [ 387 [ editor.lang.common.notSet , '' ], 379 388 [ 380 389 editor.lang.common.langDirLtr, 381 390 'ltr' … … 394 403 onLoad : function() 395 404 { 396 405 setupFields.call(this); 406 407 // Preparing for the 'elementStyle' field. 408 var dialog = this, 409 stylesField = this.getContentElement( 'info', 'elementStyle' ), 410 // Reuse the 'stylescombo' plugin's styles definition. 411 customStylesConfig = editor.config.stylesCombo_stylesSet, 412 customStylesSetName = customStylesConfig && customStylesConfig.split( ':' )[ 0 ]; 413 414 stylesField.add( editor.lang.common.notSet, '' ); 415 customStylesSetName && CKEDITOR.stylesSet.load( customStylesSetName, 416 function( stylesSet ) 417 { 418 var stylesDefinitions = stylesSet[ customStylesSetName ], 419 style, styleName; 420 421 if( stylesDefinitions ) 422 { 423 for ( var i = 0 ; i < stylesDefinitions.length ; i++ ) 424 { 425 var styleDefinition = stylesDefinitions[ i ]; 426 if( styleDefinition.element && styleDefinition.element == 'div' ) 427 { 428 styleName = styleDefinition.name; 429 style = styles[ styleName ] = new CKEDITOR.style( styleDefinition ); 430 // Populate the styles field options with style name. 431 stylesField.items.push( [ styleName, styleName ] ); 432 stylesField.add( styleName, styleName ); 433 } 434 } 435 } 436 437 // We should disable it if no styles are available. 438 var fieldBox = stylesField.getElement().getParent(); 439 stylesField.items.length ? fieldBox.removeStyle( 'display' ) : fieldBox.setStyle( 'display', 'none' ); 440 // Now setup the field value manually. 441 setTimeout( function() { stylesField.setup( dialog._element ); }, 0 ); 442 } ); 397 443 }, 398 444 onShow : function() 399 445 { -
_source/core/resourcemanager.js
127 127 var external = this.externals[ name ]; 128 128 return CKEDITOR.getUrl( 129 129 this.getPath( name ) + 130 ( ( external && external.file ) || ( this.fileName + '.js' ) ) ); 130 // External file name could be an empty one, 131 // which indicate dir is already of the full path. 132 ( external ? external.file : this.fileName + '.js' ) ); 131 133 }, 132 134 133 135 /**