Ticket #6663: 6663_2.patch
File 6663_2.patch, 2.1 KB (added by , 12 years ago) |
---|
-
_source/plugins/table/dialogs/table.js
116 116 }, 117 117 onOk : function() 118 118 { 119 if ( this._.selectedElement ) 120 { 121 var selection = editor.getSelection(), 122 bms = selection.createBookmarks(); 123 } 119 var selection = editor.getSelection(), 120 bms = selection.createBookmarks(); 124 121 125 122 var table = this._.selectedElement || makeElement( 'table' ), 126 123 me = this, … … 248 245 // Insert the table element if we're creating one. 249 246 if ( !this._.selectedElement ) 250 247 editor.insertElement( table ); 251 // Properly restore the selection inside table. (#4822)252 else253 selection.selectBookmarks( bms );254 248 249 // Properly restore the selection, (#4822) but don't break 250 // because of this, e.g. updated table caption. 251 try { selection.selectBookmarks( bms ); } catch( er ){} 252 255 253 return true; 256 254 }, 257 255 contents : [ … … 600 598 label : editor.lang.table.caption, 601 599 setup : function( selectedTable ) 602 600 { 601 this.enable(); 602 603 603 var nodeList = selectedTable.getElementsByTag( 'caption' ); 604 604 if ( nodeList.count() > 0 ) 605 605 { 606 606 var caption = nodeList.getItem( 0 ); 607 608 var innerHtml = caption.getHtml().replace(/<br>\s*$/i, ''), 609 innerText = caption.getText(); 610 611 if ( innerHtml != innerText ) 612 { 613 this.disable(); 614 this.setValue( innerText ); 615 return; 616 } 617 607 618 caption = CKEDITOR.tools.trim( caption.getText() ); 608 619 this.setValue( caption ); 609 620 } 610 621 }, 611 622 commit : function( data, table ) 612 623 { 624 if ( !this.isEnabled() ) 625 return; 626 613 627 var caption = this.getValue(), 614 628 captionElement = table.getElementsByTag( 'caption' ); 615 629 if ( caption )