Index: /CKEditor/trunk/CHANGES.html
===================================================================
--- /CKEditor/trunk/CHANGES.html (revision 6955)
+++ /CKEditor/trunk/CHANGES.html (revision 6956)
@@ -72,4 +72,5 @@
#7742 : [WebKit] Indent doesn't apply on empty document without editor focus in prior.
#7801 : [Opera] Pasted paragraphs now split partial selected blocks.
+ #6663 : Table caption that contains rich text is not anymore corrupted after edit with table dialog.
Updated the following language files:
- #7834 : Dutch;
Index: /CKEditor/trunk/_source/plugins/table/dialogs/table.js
===================================================================
--- /CKEditor/trunk/_source/plugins/table/dialogs/table.js (revision 6955)
+++ /CKEditor/trunk/_source/plugins/table/dialogs/table.js (revision 6956)
@@ -117,9 +117,6 @@
onOk : function()
{
- if ( this._.selectedElement )
- {
- var selection = editor.getSelection(),
- bms = selection.createBookmarks();
- }
+ var selection = editor.getSelection(),
+ bms = selection.createBookmarks();
var table = this._.selectedElement || makeElement( 'table' ),
@@ -249,7 +246,8 @@
if ( !this._.selectedElement )
editor.insertElement( table );
- // Properly restore the selection inside table. (#4822)
- else
- selection.selectBookmarks( bms );
+
+ // Properly restore the selection, (#4822) but don't break
+ // because of this, e.g. updated table caption.
+ try { selection.selectBookmarks( bms ); } catch( er ){}
return true;
@@ -601,8 +599,21 @@
setup : function( selectedTable )
{
+ this.enable();
+
var nodeList = selectedTable.getElementsByTag( 'caption' );
if ( nodeList.count() > 0 )
{
var caption = nodeList.getItem( 0 );
+
+ var innerHtml = caption.getHtml().replace(/
\s*$/i, ''),
+ innerText = caption.getText();
+
+ if ( innerHtml != innerText )
+ {
+ this.disable();
+ this.setValue( innerText );
+ return;
+ }
+
caption = CKEDITOR.tools.trim( caption.getText() );
this.setValue( caption );
@@ -611,4 +622,7 @@
commit : function( data, table )
{
+ if ( !this.isEnabled() )
+ return;
+
var caption = this.getValue(),
captionElement = table.getElementsByTag( 'caption' );