Changeset 5269
- Timestamp:
- 03/22/10 18:15:36 (3 years ago)
- Location:
- CKEditor/trunk
- Files:
-
- 2 added
- 1 deleted
- 4 edited
-
CHANGES.html (modified) (1 diff)
-
_source/plugins/div/dialogs/div.js (modified) (1 diff)
-
_source/plugins/styles/plugin.js (modified) (2 diffs)
-
_source/plugins/styles/styles (added)
-
_source/plugins/styles/styles/default.js (added)
-
_source/plugins/stylescombo/plugin.js (modified) (3 diffs)
-
_source/plugins/stylescombo/styles (deleted)
Legend:
- Unmodified
- Added
- Removed
-
CKEditor/trunk/CHANGES.html
r5265 r5269 44 44 <li><a href="http://dev.fckeditor.net/ticket/4810">#4810</a> : Adding configuration option for image dialog preview area filling text.</li> 45 45 <li><a href="http://dev.fckeditor.net/ticket/536">#536</a> : Object style now could be applied on any parent element of current selection.</li> 46 <li><a href="http://dev.fckeditor.net/ticket/5290">#5290</a> : Unified stylesSet loading removing dependecies from the styles combo. 47 Now the configuration entry is named 'config.stylesSet' instead of config.stylesCombo_stylesSet and the default location 48 is under the 'styles' plugin instead of 'stylescombo'.</li> 46 49 </ul> 47 50 <p> -
CKEditor/trunk/_source/plugins/div/dialogs/div.js
r5206 r5269 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 ]; 443 444 if ( stylesSetName ) 445 { 446 CKEDITOR.stylesSet.load( stylesSetName, 447 function( stylesSet ) 439 stylesField = this.getContentElement( 'info', 'elementStyle' ); 440 441 // Reuse the 'stylescombo' plugin's styles definition. 442 editor.getStylesSet( function( stylesDefinitions ) 443 { 444 var styleName; 445 446 if ( stylesDefinitions ) 447 { 448 // Digg only those styles that apply to 'div'. 449 for ( var i = 0 ; i < stylesDefinitions.length ; i++ ) 448 450 { 449 var stylesDefinitions = stylesSet[ stylesSetName ], 450 styleName; 451 452 if ( stylesDefinitions ) 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 ); 462 463 // Populate the styles field options with style name. 464 stylesField.items.push( [ styleName, styleName ] ); 465 stylesField.add( styleName, styleName ); 466 } 467 } 451 var styleDefinition = stylesDefinitions[ i ]; 452 if ( styleDefinition.element && styleDefinition.element == 'div' ) 453 { 454 styleName = styleDefinition.name; 455 styles[ styleName ] = new CKEDITOR.style( styleDefinition ); 456 457 // Populate the styles field options with style name. 458 stylesField.items.push( [ styleName, styleName ] ); 459 stylesField.add( styleName, styleName ); 468 460 } 469 470 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 } 461 } 462 } 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' ](); 467 468 // Now setup the field value manually. 469 setTimeout( function() { stylesField.setup( dialog._element ); }, 0 ); 470 } ); 479 471 }, 480 472 onShow : function() -
CKEditor/trunk/_source/plugins/styles/plugin.js
r5265 r5269 211 211 return false; 212 212 }, 213 213 214 214 checkApplicable : function( elementPath ) 215 215 { … … 1311 1311 CKEDITOR.stylesSet.load( name, callback ); 1312 1312 }; 1313 1314 1315 /** 1316 * Gets the current styleSet for this instance 1317 * @param {Function} The function to be called with the styles data. 1318 * @example 1319 * editor.getStylesSet( function( stylesDefinitions ) {} ); 1320 */ 1321 CKEDITOR.editor.prototype.getStylesSet = function( callback ) 1322 { 1323 if ( !this._.stylesDefinitions ) 1324 { 1325 var editor = this, 1326 // Respect the backwards compatible definition entry 1327 configStyleSet = editor.config.stylesCombo_stylesSet || editor.config.stylesSet, 1328 partsStylesSet = configStyleSet.split( ':' ), 1329 styleSetName = partsStylesSet[ 0 ], 1330 externalPath = partsStylesSet[ 1 ], 1331 pluginPath = CKEDITOR.plugins.registered.styles.path; 1332 1333 CKEDITOR.stylesSet.addExternal( styleSetName, 1334 externalPath ? 1335 partsStylesSet.slice( 1 ).join( ':' ) : 1336 pluginPath + 'styles/' + styleSetName + '.js', '' ); 1337 1338 1339 CKEDITOR.stylesSet.load( styleSetName, function( stylesSet ) 1340 { 1341 editor._.stylesDefinitions = stylesSet[ styleSetName ]; 1342 callback( editor._.stylesDefinitions ); 1343 } ) ; 1344 } 1345 else 1346 callback( this._.stylesDefinitions ); 1347 }; 1348 1349 /** 1350 * The "styles definition set" to use in the editor. They will be used in the 1351 * styles combo and the Style selector of the div container. <br> 1352 * The styles may be defined in the page containing the editor, or can be 1353 * loaded on demand from an external file. In the second case, if this setting 1354 * contains only a name, the styles definition file will be loaded from the 1355 * "styles" folder inside the styles plugin folder. 1356 * Otherwise, this setting has the "name:url" syntax, making it 1357 * possible to set the URL from which loading the styles file.<br> 1358 * Previously this setting was available as config.stylesCombo_stylesSet<br> 1359 * @type string 1360 * @default 'default' 1361 * @since 3.3 1362 * @example 1363 * // Load from the styles' styles folder (mystyles.js file). 1364 * config.stylesSet = 'mystyles'; 1365 * @example 1366 * // Load from a relative URL. 1367 * config.stylesSet = 'mystyles:/editorstyles/styles.js'; 1368 * @example 1369 * // Load from a full URL. 1370 * config.stylesSet = 'mystyles:http://www.example.com/editorstyles/styles.js'; 1371 */ 1372 CKEDITOR.config.stylesSet = 'default'; -
CKEditor/trunk/_source/plugins/stylescombo/plugin.js
r5243 r5269 6 6 (function() 7 7 { 8 var stylesManager;9 10 8 CKEDITOR.plugins.add( 'stylescombo', 11 9 { … … 16 14 var config = editor.config, 17 15 lang = editor.lang.stylesCombo, 18 pluginPath = this.path,19 16 styles = {}, 20 17 stylesList = []; 21 18 22 if ( !stylesManager )23 stylesManager = CKEDITOR.stylesSet;24 25 var comboStylesSet = config.stylesCombo_stylesSet.split( ':' ),26 styleSetName = comboStylesSet[ 0 ],27 externalPath = comboStylesSet[ 1 ];28 29 stylesManager.addExternal( styleSetName,30 externalPath ?31 comboStylesSet.slice( 1 ).join( ':' ) :32 pluginPath + 'styles/' + styleSetName + '.js', '' );33 34 19 function loadStylesSet( callback ) 35 { 36 CKEDITOR.stylesSet.load( styleSetName, function( stylesSet ) 37 { 38 if ( !stylesList.length ) 39 { 40 var stylesDefinitions = stylesSet[ styleSetName ], 41 style, 42 styleName; 43 44 // Put all styles into an Array. 45 for ( var i = 0 ; i < stylesDefinitions.length ; i++ ) 46 { 47 var styleDefinition = stylesDefinitions[ i ]; 48 49 styleName = styleDefinition.name; 50 51 style = styles[ styleName ] = new CKEDITOR.style( styleDefinition ); 52 style._name = styleName; 53 54 stylesList.push( style ); 55 } 56 57 // Sorts the Array, so the styles get grouped 58 // by type. 59 stylesList.sort( sortStyles ); 60 } 61 62 callback && callback(); 63 }); 64 } 20 { 21 editor.getStylesSet( function( stylesDefinitions ) 22 { 23 if ( !stylesList.length ) 24 { 25 var style, 26 styleName; 27 28 // Put all styles into an Array. 29 for ( var i = 0 ; i < stylesDefinitions.length ; i++ ) 30 { 31 var styleDefinition = stylesDefinitions[ i ]; 32 33 styleName = styleDefinition.name; 34 35 style = styles[ styleName ] = new CKEDITOR.style( styleDefinition ); 36 style._name = styleName; 37 38 stylesList.push( style ); 39 } 40 41 // Sorts the Array, so the styles get grouped by type. 42 stylesList.sort( sortStyles ); 43 } 44 45 callback && callback(); 46 }); 47 } 65 48 66 49 editor.ui.addRichCombo( 'Styles', … … 252 235 } 253 236 })(); 254 255 /**256 * The "styles definition set" to load into the styles combo. The styles may257 * be defined in the page containing the editor, or can be loaded on demand258 * from an external file when opening the styles combo for the fist time. In259 * the second case, if this setting contains only a name, the styles definition260 * file will be loaded from the "styles" folder inside the stylescombo plugin261 * folder. Otherwise, this setting has the "name:url" syntax, making it262 * possible to set the URL from which loading the styles file.263 * @type string264 * @default 'default'265 * @example266 * // Load from the stylescombo styles folder (mystyles.js file).267 * config.stylesCombo_stylesSet = 'mystyles';268 * @example269 * // Load from a relative URL.270 * config.stylesCombo_stylesSet = 'mystyles:/editorstyles/styles.js';271 * @example272 * // Load from a full URL.273 * config.stylesCombo_stylesSet = 'mystyles:http://www.example.com/editorstyles/styles.js';274 */275 CKEDITOR.config.stylesCombo_stylesSet = 'default';
Note: See TracChangeset
for help on using the changeset viewer.
