X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Ftable%2Fdialogs%2Ftable.js;h=7cb2708b85ddac79667bfde6da8b3f35141621ee;hb=039a051ccf3901311661022a30afd60fc38130c9;hp=55a45e1c15431cfb73bb5fe2f1bbed30648f0922;hpb=e371ddf8abcb89013e20e6d0dd746adec344d0e5;p=ckeditor.git diff --git a/_source/plugins/table/dialogs/table.js b/_source/plugins/table/dialogs/table.js index 55a45e1..7cb2708 100644 --- a/_source/plugins/table/dialogs/table.js +++ b/_source/plugins/table/dialogs/table.js @@ -32,8 +32,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license onLoad : function() { - var dialog = this, - isUpdating; + var dialog = this; var styles = dialog.getContentElement( 'advanced', 'advStyles' ); @@ -41,12 +40,6 @@ For licensing, see LICENSE.html or http://ckeditor.com/license { styles.on( 'change', function( evt ) { - if ( isUpdating ) - return; - - // Flag to avoid recursion. - isUpdating = 1; - // Synchronize width value. var width = this.getStyle( 'width', '' ), txtWidth = dialog.getContentElement( 'info', 'txtWidth' ), @@ -59,17 +52,15 @@ For licensing, see LICENSE.html or http://ckeditor.com/license width = parseInt( width, 10 ); } - txtWidth && txtWidth.setValue( width ); - cmbWidthType && cmbWidthType.setValue( isPx ? 'pixels' : 'percents' ); + txtWidth && txtWidth.setValue( width, true ); + cmbWidthType && cmbWidthType.setValue( isPx ? 'pixels' : 'percents', true ); // Synchronize height value. var height = this.getStyle( 'height', '' ), txtHeight = dialog.getContentElement( 'info', 'txtHeight' ); height && ( height = parseInt( height, 10 ) ); - txtHeight && txtHeight.setValue( height ); - - isUpdating = 0; + txtHeight && txtHeight.setValue( height, true ); }); } }, @@ -88,11 +79,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license if ( command == 'tableProperties' ) { - if ( ( selectedTable = editor.getSelection().getSelectedElement() ) ) - { - if ( selectedTable.getName() != 'table' ) - selectedTable = null; - } + if ( ( selectedTable = selection.getSelectedElement() ) ) + selectedTable = selectedTable.getAscendant( 'table', true ); else if ( ranges.length > 0 ) { // Webkit could report the following range on cell selection (#4948): @@ -108,19 +96,17 @@ For licensing, see LICENSE.html or http://ckeditor.com/license this._.selectedElement = selectedTable; } - // Enable, disable and select the row, cols, width fields. + // Enable or disable the row, cols, width fields. if ( selectedTable ) { this.setupContent( selectedTable ); rowsInput && rowsInput.disable(); colsInput && colsInput.disable(); - widthInput && widthInput.select(); } else { rowsInput && rowsInput.enable(); colsInput && colsInput.enable(); - rowsInput && rowsInput.select(); } // Call the onChange method for the widht and height fields so @@ -133,7 +119,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license if ( this._.selectedElement ) { var selection = editor.getSelection(), - bms = editor.getSelection().createBookmarks(); + bms = selection.createBookmarks(); } var table = this._.selectedElement || makeElement( 'table' ), @@ -180,7 +166,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license for ( i = 0 ; i < theRow.getChildCount() ; i++ ) { var th = theRow.getChild( i ); - if ( th.type == CKEDITOR.NODE_ELEMENT ) + // Skip bookmark nodes. (#6155) + if ( th.type == CKEDITOR.NODE_ELEMENT && !th.hasAttribute( '_cke_bookmark' ) ) { th.renameNode( 'th' ); th.setAttribute( 'scope', 'col' ); @@ -617,8 +604,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license if ( nodeList.count() > 0 ) { var caption = nodeList.getItem( 0 ); - caption = ( caption.getChild( 0 ) && caption.getChild( 0 ).getText() ) || ''; - caption = CKEDITOR.tools.trim( caption ); + caption = CKEDITOR.tools.trim( caption.getText() ); this.setValue( caption ); } },