Ticket #5418: 5418_7.patch
File 5418_7.patch, 14.6 KB (added by , 15 years ago) |
---|
-
_source/core/config.js
243 243 * @type String 244 244 * @example 245 245 */ 246 plugins : 'about,a11yhelp,basicstyles,bidi,blockquote,button,clipboard,colorbutton,colordialog,contextmenu,di v,elementspath,enterkey,entities,filebrowser,find,flash,font,format,forms,horizontalrule,htmldataprocessor,image,indent,justify,keystrokes,link,list,liststyle,maximize,newpage,pagebreak,pastefromword,pastetext,popup,preview,print,removeformat,resize,save,scayt,smiley,showblocks,showborders,sourcearea,stylescombo,table,tabletools,specialchar,tab,templates,toolbar,undo,wysiwygarea,wsc',246 plugins : 'about,a11yhelp,basicstyles,bidi,blockquote,button,clipboard,colorbutton,colordialog,contextmenu,dialogadvtab,div,elementspath,enterkey,entities,filebrowser,find,flash,font,format,forms,horizontalrule,htmldataprocessor,image,indent,justify,keystrokes,link,list,liststyle,maximize,newpage,pagebreak,pastefromword,pastetext,popup,preview,print,removeformat,resize,save,scayt,smiley,showblocks,showborders,sourcearea,stylescombo,table,tabletools,specialchar,tab,templates,toolbar,undo,wysiwygarea,wsc', 247 247 248 248 /** 249 249 * List of additional plugins to be loaded. This is a tool setting which -
_source/lang/en.js
105 105 targetTop : 'Topmost Window (_top)', 106 106 targetSelf : 'Same Window (_self)', 107 107 targetParent : 'Parent Window (_parent)', 108 advanced : 'Advanced', 109 langDirLTR : 'Left to Right (LTR)', 110 langDirRTL : 'Right to Left (RTL)', 111 styles : 'Style', 112 cssClasses : 'Stylesheet Classes', 108 113 109 114 // Put the voice-only part of the label in the span. 110 115 unavailable : '%1<span class="cke_accessibility">, unavailable</span>' -
_source/plugins/dialog/plugin.js
472 472 473 473 // Insert the tabs and contents. 474 474 for ( var i = 0 ; i < definition.contents.length ; i++ ) 475 this.addPage( definition.contents[i] ); 475 { 476 var page = definition.contents[i]; 477 page && this.addPage( page ); 478 } 476 479 477 480 this.parts['tabs'].on( 'click', function( evt ) 478 481 { … … 1386 1389 // Transform the contents entries in contentObjects. 1387 1390 var contents = dialogDefinition.contents; 1388 1391 for ( var i = 0, content ; ( content = contents[i] ) ; i++ ) 1389 contents[ i ] = new contentObject( dialog, content );1392 contents[ i ] = content && new contentObject( dialog, content ); 1390 1393 1391 1394 CKEDITOR.tools.extend( this, dialogDefinition ); 1392 1395 }; -
_source/plugins/dialogadvtab/plugin.js
Property changes on: _source\plugins\dialogadvtab ___________________________________________________________________ Added: bugtraq:label + Ticket Added: bugtraq:url + http://dev.ckeditor.com/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 (function() 7 { 8 9 function setupAdvParams( element ) 10 { 11 var attrName = this.att; 12 13 var value = element && element.hasAttribute( attrName ) && element.getAttribute( attrName ) || ''; 14 15 if ( value !== undefined ) 16 this.setValue( value ); 17 } 18 19 function commitAdvParams() 20 { 21 // Dialogs may use different parameters in the commit list, so, by 22 // definition, we take the first CKEDITOR.dom.element available. 23 var element; 24 25 for ( var i = 0 ; i < arguments.length ; i++ ) 26 { 27 if ( arguments[ i ] instanceof CKEDITOR.dom.element ) 28 { 29 element = arguments[ i ]; 30 break; 31 } 32 } 33 34 if ( element ) 35 { 36 var attrName = this.att, 37 value = this.getValue(); 38 39 if ( value ) 40 element.setAttribute( attrName, value ); 41 else 42 element.removeAttribute( attrName, value ); 43 } 44 } 45 46 var isUpdating; 47 48 CKEDITOR.plugins.add( 'dialogadvtab', 49 { 50 /** 51 * 52 * @param tabConfig 53 * id, dir, classes, styles 54 */ 55 createAdvancedTab : function( editor, tabConfig ) 56 { 57 if ( !tabConfig ) 58 tabConfig = { id:1, dir:1, classes:1, styles:1 }; 59 60 var lang = editor.lang.common; 61 62 var result = 63 { 64 id : 'advanced', 65 label : lang.advanced, 66 title : lang.advanced, 67 elements : 68 [ 69 { 70 type : 'vbox', 71 padding : 1, 72 children : [] 73 } 74 ] 75 }; 76 77 var contents = []; 78 79 if ( tabConfig.id || tabConfig.dir ) 80 { 81 if ( tabConfig.id ) 82 { 83 contents.push( 84 { 85 id : 'advId', 86 att : 'id', 87 type : 'text', 88 label : lang.id, 89 setup : setupAdvParams, 90 commit : commitAdvParams 91 }); 92 } 93 94 if ( tabConfig.dir ) 95 { 96 contents.push( 97 { 98 id : 'advLangDir', 99 att : 'dir', 100 type : 'select', 101 label : lang.langDir, 102 'default' : '', 103 style : 'width:110px', 104 items : 105 [ 106 [ lang.notSet, '' ], 107 [ lang.langDirLTR, 'ltr' ], 108 [ lang.langDirRTL, 'rtl' ] 109 ], 110 setup : setupAdvParams, 111 commit : commitAdvParams 112 }); 113 } 114 115 result.elements[ 0 ].children.push( 116 { 117 type : 'hbox', 118 widths : [ '50%', '50%' ], 119 children : [].concat( contents ) 120 }); 121 } 122 123 if ( tabConfig.styles || tabConfig.classes ) 124 { 125 contents = []; 126 127 if ( tabConfig.id ) 128 { 129 contents.push( 130 { 131 id : 'advStyles', 132 att : 'style', 133 type : 'text', 134 label : lang.styles, 135 'default' : '', 136 137 onChange : function(){}, 138 139 getStyle : function( name, defaultValue ) 140 { 141 var match = this.getValue().match( new RegExp( name + '\\s*:\s*([^;]*)', 'i') ); 142 return match ? match[ 1 ] : defaultValue; 143 }, 144 145 updateStyle : function( name, value ) 146 { 147 if ( isUpdating ) 148 return; 149 150 // Flag to avoid recursion. 151 isUpdating = 1; 152 153 var styles = this.getValue(); 154 155 // Remove the current value. 156 if ( styles ) 157 { 158 styles = styles 159 .replace( new RegExp( '\\s*' + name + '\s*:[^;]*(?:$|;\s*)', 'i' ), '' ) 160 .replace( /^[;\s]+/, '' ) 161 .replace( /\s+$/, '' ); 162 } 163 164 if ( value ) 165 { 166 styles && !(/;\s*$/).test( styles ) && ( styles += '; ' ); 167 styles += name + ': ' + value; 168 } 169 170 this.setValue( styles ); 171 172 isUpdating = 0; 173 }, 174 175 setup : setupAdvParams, 176 177 commit : commitAdvParams 178 179 }); 180 } 181 182 if ( tabConfig.classes ) 183 { 184 contents.push( 185 { 186 type : 'hbox', 187 widths : [ '45%', '55%' ], 188 children : 189 [ 190 { 191 id : 'advCSSClasses', 192 att : 'class', 193 type : 'text', 194 label : lang.cssClasses, 195 'default' : '', 196 setup : setupAdvParams, 197 commit : commitAdvParams 198 199 } 200 ] 201 }); 202 } 203 204 result.elements[ 0 ].children.push( 205 { 206 type : 'hbox', 207 widths : [ '50%', '50%' ], 208 children : [].concat( contents ) 209 }); 210 } 211 212 return result; 213 } 214 }); 215 216 })(); -
_source/plugins/filebrowser/plugin.js
388 388 // Associate filebrowser to elements with 'filebrowser' attribute. 389 389 for ( var i in definition.contents ) 390 390 { 391 element = definition.contents[ i ] ; 392 attachFileBrowser( evt.editor, evt.data.name, definition, element.elements ); 393 if ( element.hidden && element.filebrowser ) 391 if ( ( element = definition.contents[ i ] ) ) 394 392 { 395 element.hidden = !isConfigured( definition, element[ 'id' ], element.filebrowser ); 393 attachFileBrowser( evt.editor, evt.data.name, definition, element.elements ); 394 if ( element.hidden && element.filebrowser ) 395 { 396 element.hidden = !isConfigured( definition, element[ 'id' ], element.filebrowser ); 397 } 396 398 } 397 399 } 398 400 } ); -
_source/plugins/showborders/plugin.js
153 153 selectedTable[ ( !value || value <= 0 ) ? 'addClass' : 'removeClass' ]( showBorderClassName ); 154 154 }; 155 155 } ); 156 157 var advTab = dialogDefinition.getContents( 'advanced' ), 158 classField = advTab && advTab.get( 'advCSSClasses' ); 159 160 if ( classField ) 161 { 162 classField.setup = CKEDITOR.tools.override( classField.setup, function( originalSetup ) 163 { 164 return function() 165 { 166 originalSetup.apply( this, arguments ); 167 this.setValue( this.getValue().replace( /cke_show_border/, '' ) ); 168 }; 169 }); 170 171 classField.commit = CKEDITOR.tools.override( classField.commit, function( originalCommit ) 172 { 173 return function( data, element ) 174 { 175 originalCommit.apply( this, arguments ); 176 177 if ( !parseInt( element.getAttribute( 'border' ), 10 ) ) 178 element.addClass( 'cke_show_border' ); 179 }; 180 }); 181 } 156 182 } 157 183 }); 158 184 -
_source/plugins/table/dialogs/table.js
18 18 19 19 function tableDialog( editor, command ) 20 20 { 21 var makeElement = function( name ){ return new CKEDITOR.dom.element( name, editor.document ); }; 21 var makeElement = function( name ) 22 { 23 return new CKEDITOR.dom.element( name, editor.document ); 24 }; 22 25 26 var dialogadvtab = editor.plugins.dialogadvtab; 27 23 28 return { 24 29 title : editor.lang.table.title, 25 30 minWidth : 310, 26 31 minHeight : CKEDITOR.env.ie ? 310 : 280, 32 33 onLoad : function() 34 { 35 var dialog = this, 36 isUpdating; 37 38 var styles = dialog.getContentElement( 'advanced', 'advStyles' ); 39 40 if ( styles ) 41 { 42 styles.on( 'change', function( evt ) 43 { 44 if ( isUpdating ) 45 return; 46 47 // Flag to avoid recursion. 48 isUpdating = 1; 49 50 // Synchronize width value. 51 var width = this.getStyle( 'width', '' ), 52 isPx = 1; 53 54 if ( width ) 55 { 56 isPx = ( width.length < 3 || width.substr( width.length - 1 ) != '%' ); 57 width = parseInt( width, 10 ); 58 } 59 60 dialog.getContentElement( 'info', 'txtWidth' ).setValue( width ); 61 dialog.getContentElement( 'info', 'cmbWidthType' ).setValue( isPx ? 'pixels' : 'percents' ); 62 63 // Synchronize height value. 64 var height = this.getStyle( 'height', '' ); 65 height && ( height = parseInt( height, 10 ) ); 66 dialog.getContentElement( 'info', 'txtHeight' ).setValue( height ); 67 68 isUpdating = 0; 69 }); 70 } 71 }, 72 27 73 onShow : function() 28 74 { 29 75 // Detect if there's a selected table. … … 70 116 colsInput && colsInput.enable(); 71 117 rowsInput && rowsInput.select(); 72 118 } 119 120 // Call the onChange method for the widht and height fields so 121 // they get reflected into the Advanced tab. 122 widthInput.onChange(); 123 this.getContentElement( 'info', 'txtHeight' ).onChange(); 73 124 }, 74 125 onOk : function() 75 126 { … … 378 429 id : 'txtWidth', 379 430 style : 'width:5em', 380 431 label : editor.lang.table.width, 381 'default' : 200,432 'default' : 500, 382 433 validate : CKEDITOR.dialog.validate['number']( editor.lang.table.invalidWidth ), 383 434 384 435 // Extra labelling of width unit type. … … 392 443 inputElement.setAttribute( 'aria-labelledby', [ ariaLabelledByAttr, labelElement.$.id ].join( ' ' ) ); 393 444 }, 394 445 446 onChange : function() 447 { 448 var styles = this.getDialog().getContentElement( 'advanced', 'advStyles' ); 449 450 if ( styles ) 451 { 452 var value = this.getValue(); 453 454 if ( value ) 455 value += this.getDialog().getContentElement( 'info', 'cmbWidthType' ).getValue() == 'percents' ? '%' : 'px'; 456 457 styles.updateStyle( 'width', value ); 458 } 459 }, 460 395 461 setup : function( selectedTable ) 396 462 { 397 463 var widthMatch = widthPattern.exec( selectedTable.$.style.width ); … … 419 485 if ( widthMatch ) 420 486 this.setValue( widthMatch[2] == 'px' ? 'pixels' : 'percents' ); 421 487 }, 488 onChange : function() 489 { 490 this.getDialog().getContentElement( 'info', 'txtWidth' ).onChange(); 491 }, 422 492 commit : commitValue 423 493 } 424 494 ] … … 447 517 inputElement.setAttribute( 'aria-labelledby', [ ariaLabelledByAttr, labelElement.$.id ].join( ' ' ) ); 448 518 }, 449 519 520 onChange : function() 521 { 522 var styles = this.getDialog().getContentElement( 'advanced', 'advStyles' ); 523 524 if ( styles ) 525 { 526 var value = this.getValue(); 527 styles.updateStyle( 'height', value && ( value + 'px' ) ); 528 } 529 }, 530 450 531 setup : function( selectedTable ) 451 532 { 452 533 var heightMatch = heightPattern.exec( selectedTable.$.style.height ); … … 580 661 ] 581 662 } 582 663 ] 583 } 664 }, 665 dialogadvtab && dialogadvtab.createAdvancedTab( editor ) 584 666 ] 585 667 }; 586 668 }