Ticket #5290: 5290_2.patch
File 5290_2.patch, 16.1 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( 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/styles/plugin.js
179 179 } 180 180 return false; 181 181 }, 182 182 183 183 checkApplicable : function( elementPath ) 184 184 { 185 185 switch ( this.type ) … … 1278 1278 CKEDITOR.stylesSet.addExternal( name, url, '' ); 1279 1279 CKEDITOR.stylesSet.load( name, callback ); 1280 1280 }; 1281 1282 1283 /** 1284 * Gets the current styleSet for this instance 1285 * @param {Function} The function to be called with the styles data. 1286 * @example 1287 * editor.getStylesSet( function( stylesDefinitions ) {} ); 1288 */ 1289 CKEDITOR.editor.prototype.getStylesSet = function( callback ) 1290 { 1291 if ( !this._.stylesDefinitions ) 1292 { 1293 var editor = this, 1294 // Respect the backwards compatible definition entry 1295 configStyleSet = editor.config.stylesCombo_stylesSet || editor.config.stylesSet, 1296 partsStylesSet = configStyleSet.split( ':' ), 1297 styleSetName = partsStylesSet[ 0 ], 1298 externalPath = partsStylesSet[ 1 ], 1299 pluginPath = CKEDITOR.plugins.registered.styles.path; 1300 1301 CKEDITOR.stylesSet.addExternal( styleSetName, 1302 externalPath ? 1303 partsStylesSet.slice( 1 ).join( ':' ) : 1304 pluginPath + 'styles/' + styleSetName + '.js', '' ); 1305 1306 1307 CKEDITOR.stylesSet.load( styleSetName, function( stylesSet ) 1308 { 1309 editor._.stylesDefinitions = stylesSet[ styleSetName ]; 1310 callback( editor._.stylesDefinitions ); 1311 } ) ; 1312 } 1313 else 1314 callback( this._.stylesDefinitions ); 1315 }; 1316 1317 /** 1318 * The "styles definition set" to use in the editor. They will be used in the 1319 * styles combo and the Style selector of the div container. <br> 1320 * The styles may be defined in the page containing the editor, or can be 1321 * loaded on demand from an external file. In the second case, if this setting 1322 * contains only a name, the styles definition file will be loaded from the 1323 * "styles" folder inside the styles plugin folder. 1324 * Otherwise, this setting has the "name:url" syntax, making it 1325 * possible to set the URL from which loading the styles file.<br> 1326 * Previously this setting was available as config.stylesCombo_stylesSet<br> 1327 * @type string 1328 * @default 'default' 1329 * @since 3.3 1330 * @example 1331 * // Load from the styles' styles folder (mystyles.js file). 1332 * config.stylesSet = 'mystyles'; 1333 * @example 1334 * // Load from a relative URL. 1335 * config.stylesSet = 'mystyles:/editorstyles/styles.js'; 1336 * @example 1337 * // Load from a full URL. 1338 * config.stylesSet = 'mystyles:http://www.example.com/editorstyles/styles.js'; 1339 */ 1340 CKEDITOR.config.stylesSet = 'default'; -
_source/plugins/styles/styles/default.js
Property changes on: _source\plugins\styles\styles ___________________________________________________________________ Added: bugtraq:label + Ticket Added: bugtraq:url + http://dev.fckeditor.net/ticket/%BUGID% Added: webviewer:pathrevision + http://dev.fckeditor.net/browser/%PATH%?rev=%REVISION% Added: webviewer:revision + http://dev.fckeditor.net/changeset/%REVISION% Added: bugtraq:logregex + (?:ticket: *|#)(\d+) *(?:, *(\d+))*
1 /* 2 Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. 3 For licensing, see LICENSE.html or http://ckeditor.com/license 4 */ 5 6 CKEDITOR.stylesSet.add( 'default', 7 [ 8 /* Block Styles */ 9 10 // These styles are already available in the "Format" combo, so they are 11 // not needed here by default. You may enable them to avoid placing the 12 // "Format" combo in the toolbar, maintaining the same features. 13 /* 14 { name : 'Paragraph' , element : 'p' }, 15 { name : 'Heading 1' , element : 'h1' }, 16 { name : 'Heading 2' , element : 'h2' }, 17 { name : 'Heading 3' , element : 'h3' }, 18 { name : 'Heading 4' , element : 'h4' }, 19 { name : 'Heading 5' , element : 'h5' }, 20 { name : 'Heading 6' , element : 'h6' }, 21 { name : 'Preformatted Text', element : 'pre' }, 22 { name : 'Address' , element : 'address' }, 23 */ 24 25 { name : 'Blue Title' , element : 'h3', styles : { 'color' : 'Blue' } }, 26 { name : 'Red Title' , element : 'h3', styles : { 'color' : 'Red' } }, 27 28 /* Inline Styles */ 29 30 // These are core styles available as toolbar buttons. You may opt enabling 31 // some of them in the Styles combo, removing them from the toolbar. 32 /* 33 { name : 'Strong' , element : 'strong', overrides : 'b' }, 34 { name : 'Emphasis' , element : 'em' , overrides : 'i' }, 35 { name : 'Underline' , element : 'u' }, 36 { name : 'Strikethrough' , element : 'strike' }, 37 { name : 'Subscript' , element : 'sub' }, 38 { name : 'Superscript' , element : 'sup' }, 39 */ 40 41 { name : 'Marker: Yellow' , element : 'span', styles : { 'background-color' : 'Yellow' } }, 42 { name : 'Marker: Green' , element : 'span', styles : { 'background-color' : 'Lime' } }, 43 44 { name : 'Big' , element : 'big' }, 45 { name : 'Small' , element : 'small' }, 46 { name : 'Typewriter' , element : 'tt' }, 47 48 { name : 'Computer Code' , element : 'code' }, 49 { name : 'Keyboard Phrase' , element : 'kbd' }, 50 { name : 'Sample Text' , element : 'samp' }, 51 { name : 'Variable' , element : 'var' }, 52 53 { name : 'Deleted Text' , element : 'del' }, 54 { name : 'Inserted Text' , element : 'ins' }, 55 56 { name : 'Cited Work' , element : 'cite' }, 57 { name : 'Inline Quotation' , element : 'q' }, 58 59 { name : 'Language: RTL' , element : 'span', attributes : { 'dir' : 'rtl' } }, 60 { name : 'Language: LTR' , element : 'span', attributes : { 'dir' : 'ltr' } }, 61 62 /* Object Styles */ 63 64 { 65 name : 'Image on Left', 66 element : 'img', 67 attributes : 68 { 69 'style' : 'padding: 5px; margin-right: 5px', 70 'border' : '2', 71 'align' : 'left' 72 } 73 }, 74 75 { 76 name : 'Image on Right', 77 element : 'img', 78 attributes : 79 { 80 'style' : 'padding: 5px; margin-left: 5px', 81 'border' : '2', 82 'align' : 'right' 83 } 84 }, 85 86 { name : 'Borderless Table', element : 'table', styles: { 'border-style': 'hidden', 'background-color' : '#E6E6FA' } }, 87 { name : 'Square Bulleted List', element : 'ul', styles : { 'list-style-type' : 'square' } } 88 ]); -
_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 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; 20 { 21 editor.getStylesSet( function( stylesDefinitions ) 22 { 23 if ( !stylesList.length ) 24 { 25 var style, 26 styleName; 43 27 44 45 46 47 28 // Put all styles into an Array. 29 for ( var i = 0 ; i < stylesDefinitions.length ; i++ ) 30 { 31 var styleDefinition = stylesDefinitions[ i ]; 48 32 49 33 styleName = styleDefinition.name; 50 34 51 52 35 style = styles[ styleName ] = new CKEDITOR.style( styleDefinition ); 36 style._name = styleName; 53 37 54 55 38 stylesList.push( style ); 39 } 56 40 57 // Sorts the Array, so the styles get grouped 58 // by type. 59 stylesList.sort( sortStyles ); 60 } 41 // Sorts the Array, so the styles get grouped by type. 42 stylesList.sort( sortStyles ); 43 } 61 44 62 63 64 45 callback && callback(); 46 }); 47 } 65 48 66 49 editor.ui.addRichCombo( 'Styles', 67 50 { … … 251 234 -1; 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'; -
_source/plugins/stylescombo/styles/default.js
1 /*2 Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.3 For licensing, see LICENSE.html or http://ckeditor.com/license4 */5 6 CKEDITOR.stylesSet.add( 'default',7 [8 /* Block Styles */9 10 // These styles are already available in the "Format" combo, so they are11 // not needed here by default. You may enable them to avoid placing the12 // "Format" combo in the toolbar, maintaining the same features.13 /*14 { name : 'Paragraph' , element : 'p' },15 { name : 'Heading 1' , element : 'h1' },16 { name : 'Heading 2' , element : 'h2' },17 { name : 'Heading 3' , element : 'h3' },18 { name : 'Heading 4' , element : 'h4' },19 { name : 'Heading 5' , element : 'h5' },20 { name : 'Heading 6' , element : 'h6' },21 { name : 'Preformatted Text', element : 'pre' },22 { name : 'Address' , element : 'address' },23 */24 25 { name : 'Blue Title' , element : 'h3', styles : { 'color' : 'Blue' } },26 { name : 'Red Title' , element : 'h3', styles : { 'color' : 'Red' } },27 28 /* Inline Styles */29 30 // These are core styles available as toolbar buttons. You may opt enabling31 // some of them in the Styles combo, removing them from the toolbar.32 /*33 { name : 'Strong' , element : 'strong', overrides : 'b' },34 { name : 'Emphasis' , element : 'em' , overrides : 'i' },35 { name : 'Underline' , element : 'u' },36 { name : 'Strikethrough' , element : 'strike' },37 { name : 'Subscript' , element : 'sub' },38 { name : 'Superscript' , element : 'sup' },39 */40 41 { name : 'Marker: Yellow' , element : 'span', styles : { 'background-color' : 'Yellow' } },42 { name : 'Marker: Green' , element : 'span', styles : { 'background-color' : 'Lime' } },43 44 { name : 'Big' , element : 'big' },45 { name : 'Small' , element : 'small' },46 { name : 'Typewriter' , element : 'tt' },47 48 { name : 'Computer Code' , element : 'code' },49 { name : 'Keyboard Phrase' , element : 'kbd' },50 { name : 'Sample Text' , element : 'samp' },51 { name : 'Variable' , element : 'var' },52 53 { name : 'Deleted Text' , element : 'del' },54 { name : 'Inserted Text' , element : 'ins' },55 56 { name : 'Cited Work' , element : 'cite' },57 { name : 'Inline Quotation' , element : 'q' },58 59 { name : 'Language: RTL' , element : 'span', attributes : { 'dir' : 'rtl' } },60 { name : 'Language: LTR' , element : 'span', attributes : { 'dir' : 'ltr' } },61 62 /* Object Styles */63 64 {65 name : 'Image on Left',66 element : 'img',67 attributes :68 {69 'style' : 'padding: 5px; margin-right: 5px',70 'border' : '2',71 'align' : 'left'72 }73 },74 75 {76 name : 'Image on Right',77 element : 'img',78 attributes :79 {80 'style' : 'padding: 5px; margin-left: 5px',81 'border' : '2',82 'align' : 'right'83 }84 },85 86 { name : 'Borderless Table', element : 'table', styles: { 'border-style': 'hidden', 'background-color' : '#E6E6FA' } },87 { name : 'Square Bulleted List', element : 'ul', styles : { 'list-style-type' : 'square' } }88 ]);