X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Ftable%2Fdialogs%2Ftable.js;h=87e55df68bf3e7e49e8d77e9e5a6afee6891519e;hb=059b4c2fef02528bf1af189f7996e80652faddfb;hp=6a082d25236bdc5db6fef0253952c1f90607bb0f;hpb=7cd80714081a8ffdf4a1a8d2c72f120ed5ef3d6d;p=ckeditor.git
diff --git a/_source/plugins/table/dialogs/table.js b/_source/plugins/table/dialogs/table.js
index 6a082d2..87e55df 100644
--- a/_source/plugins/table/dialogs/table.js
+++ b/_source/plugins/table/dialogs/table.js
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
@@ -68,6 +68,12 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
},
onOk : function()
{
+ if ( this._.selectedElement )
+ {
+ var selection = editor.getSelection(),
+ bms = editor.getSelection().createBookmarks();
+ }
+
var table = this._.selectedElement || makeElement( 'table' ),
me = this,
data = {};
@@ -148,7 +154,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
// Should we make all first cells in a row TH?
if ( !this.hasColumnHeaders && ( headers == 'col' || headers == 'both' ) )
{
- for( row = 0 ; row < table.$.rows.length ; row++ )
+ for ( row = 0 ; row < table.$.rows.length ; row++ )
{
newCell = new CKEDITOR.dom.element( table.$.rows[ row ].cells[ 0 ] );
newCell.renameNode( 'th' );
@@ -159,7 +165,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
// Should we make all first TH-cells in a row make TD? If 'yes' we do it the other way round :-)
if ( ( this.hasColumnHeaders ) && !( headers == 'col' || headers == 'both' ) )
{
- for( i = 0 ; i < table.$.rows.length ; i++ )
+ for ( i = 0 ; i < table.$.rows.length ; i++ )
{
row = new CKEDITOR.dom.element( table.$.rows[i] );
if ( row.getParent().getName() == 'tbody' )
@@ -186,13 +192,16 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
else
table.removeStyle( 'width' );
- if( !table.getAttribute( 'style' ) )
+ if ( !table.getAttribute( 'style' ) )
table.removeAttribute( 'style' );
}
// Insert the table element if we're creating one.
if ( !this._.selectedElement )
editor.insertElement( table );
+ // Properly restore the selection inside table. (#4822)
+ else
+ selection.selectBookmarks( bms );
return true;
},
@@ -330,7 +339,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
label : editor.lang.table.align,
items :
[
- [ editor.lang.table.alignNotSet , ''],
+ [ editor.lang.common.notSet , ''],
[ editor.lang.table.alignLeft , 'left'],
[ editor.lang.table.alignCenter , 'center'],
[ editor.lang.table.alignRight , 'right']
@@ -366,18 +375,33 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
label : editor.lang.table.width,
'default' : 200,
validate : CKEDITOR.dialog.validate['number']( editor.lang.table.invalidWidth ),
+
+ // Extra labelling of width unit type.
+ onLoad : function()
+ {
+ var widthType = this.getDialog().getContentElement( 'info', 'cmbWidthType' ),
+ labelElement = widthType.getElement(),
+ inputElement = this.getInputElement(),
+ ariaLabelledByAttr = inputElement.getAttribute( 'aria-labelledby' );
+
+ inputElement.setAttribute( 'aria-labelledby', [ ariaLabelledByAttr, labelElement.$.id ].join( ' ' ) );
+ },
+
setup : function( selectedTable )
{
var widthMatch = widthPattern.exec( selectedTable.$.style.width );
if ( widthMatch )
this.setValue( widthMatch[1] );
+ else
+ this.setValue( '' );
},
commit : commitValue
},
{
id : 'cmbWidthType',
type : 'select',
- label : ' ',
+ label : editor.lang.table.widthUnit,
+ labelStyle: 'visibility:hidden',
'default' : 'pixels',
items :
[
@@ -406,6 +430,18 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
label : editor.lang.table.height,
'default' : '',
validate : CKEDITOR.dialog.validate['number']( editor.lang.table.invalidHeight ),
+
+ // Extra labelling of height unit type.
+ onLoad : function()
+ {
+ var heightType = this.getDialog().getContentElement( 'info', 'htmlHeightType' ),
+ labelElement = heightType.getElement(),
+ inputElement = this.getInputElement(),
+ ariaLabelledByAttr = inputElement.getAttribute( 'aria-labelledby' );
+
+ inputElement.setAttribute( 'aria-labelledby', [ ariaLabelledByAttr, labelElement.$.id ].join( ' ' ) );
+ },
+
setup : function( selectedTable )
{
var heightMatch = heightPattern.exec( selectedTable.$.style.height );
@@ -415,8 +451,9 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
commit : commitValue
},
{
+ id : 'htmlHeightType',
type : 'html',
- html : '
' + editor.lang.table.widthPx
+ html : '