Ticket #7886: 7886.patch
File 7886.patch, 3.9 KB (added by , 13 years ago) |
---|
-
_source/plugins/table/dialogs/table.js
93 93 } 94 94 95 95 // Save a reference to the selected table, and push a new set of default values. 96 this. _.selectedElement = selectedTable;96 this.element = selectedTable; 97 97 } 98 98 99 99 // Enable or disable the row, cols, width fields. … … 116 116 }, 117 117 onOk : function() 118 118 { 119 if ( this. _.selectedElement )119 if ( this.element ) 120 120 { 121 121 var selection = editor.getSelection(), 122 122 bms = selection.createBookmarks(); 123 123 } 124 124 125 var table = this. _.selectedElement || makeElement( 'table'),125 var table = this.element || ( this.element = makeElement( 'table' ) ), 126 126 me = this, 127 127 data = {}; 128 128 … … 133 133 var info = data.info; 134 134 135 135 // Generate the rows and cols. 136 if ( !this._.selectedElement)136 if ( this.element.isOffline() ) 137 137 { 138 138 var tbody = table.append( makeElement( 'tbody' ) ), 139 139 rows = parseInt( info.txtRows, 10 ) || 0, … … 246 246 } 247 247 248 248 // Insert the table element if we're creating one. 249 if ( !this._.selectedElement)249 if ( table.isOffline() ) 250 250 editor.insertElement( table ); 251 251 // Properly restore the selection inside table. (#4822) 252 252 else -
_source/plugins/showborders/plugin.js
151 151 152 152 if ( dialogName == 'table' || dialogName == 'tableProperties' ) 153 153 { 154 var dialogDefinition = ev.data.definition, 155 infoTab = dialogDefinition.getContents( 'info' ), 156 borderField = infoTab.get( 'txtBorder' ), 157 originalCommit = borderField.commit; 154 var dialogDefinition = ev.data.definition; 158 155 159 borderField.commit = CKEDITOR.tools.override( originalCommit, function( org )160 {161 return function( data, selectedTable )162 {163 org.apply( this, arguments );164 var value = parseInt( this.getValue(), 10 );165 selectedTable[ ( !value || value <= 0 ) ? 'addClass' : 'removeClass' ]( showBorderClassName );166 };167 } );168 169 156 var advTab = dialogDefinition.getContents( 'advanced' ), 170 157 classField = advTab && advTab.get( 'advCSSClasses' ); 171 158 … … 179 166 this.setValue( this.getValue().replace( /cke_show_border/, '' ) ); 180 167 }; 181 168 }); 169 } 182 170 183 classField.commit = CKEDITOR.tools.override( classField.commit, function( originalCommit ) 184 { 185 return function( data, element ) 186 { 187 originalCommit.apply( this, arguments ); 188 189 if ( !parseInt( element.getAttribute( 'border' ), 10 ) ) 190 element.addClass( 'cke_show_border' ); 191 }; 192 }); 193 } 194 } 171 dialogDefinition.onOk = CKEDITOR.tools.override( dialogDefinition.onOk, function( org ) 172 { 173 return function() 174 { 175 org.apply( this, arguments ); 176 var border = parseInt( this.element.getAttribute( 'border' ), 10 ); 177 this.element[ !isNaN( border) && border > 0 ? 'removeClass' : 'addClass' ]( showBorderClassName ); 178 }; 179 }); 180 181 } 195 182 }); 196 183 197 184 } )(); -
_source/core/dom/element.js
1568 1568 return this.$.childNodes.length; 1569 1569 }, 1570 1570 1571 /** 1572 * Whether this element is not yet presented in the DOM tree. 1573 */ 1574 isOffline : function() 1575 { 1576 var root = this.getDocument().getDocumentElement(); 1577 return !root.contains( this ); 1578 }, 1579 1571 1580 disableContextMenu : function() 1572 1581 { 1573 1582 this.on( 'contextmenu', function( event )