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