/*\r
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.\r
For licensing, see LICENSE.html or http://ckeditor.com/license\r
*/\r
\r
( CKEDITOR.env.ie6Compat ?\r
[\r
'.%1 table.%2,',\r
- '.%1 table.%2 td, .%1 table.%2 th,',\r
+ '.%1 table.%2 td, .%1 table.%2 th',\r
'{',\r
'border : #d3d3d3 1px dotted',\r
'}'\r
{\r
preserveState : true,\r
editorFocus : false,\r
+ readOnly: 1,\r
\r
exec : function ( editor )\r
{\r
\r
refresh : function( editor )\r
{\r
- var funcName = ( this.state == CKEDITOR.TRISTATE_ON ) ? 'addClass' : 'removeClass';\r
- editor.document.getBody()[ funcName ]( 'cke_show_borders' );\r
+ if ( editor.document )\r
+ {\r
+ var funcName = ( this.state == CKEDITOR.TRISTATE_ON ) ? 'addClass' : 'removeClass';\r
+ editor.document.getBody()[ funcName ]( 'cke_show_borders' );\r
+ }\r
}\r
};\r
\r
if ( command.state != CKEDITOR.TRISTATE_DISABLED )\r
command.refresh( editor );\r
});\r
+\r
+ editor.on( 'removeFormatCleanup', function( evt )\r
+ {\r
+ var element = evt.data;\r
+ if ( editor.getCommand( 'showborders' ).state == CKEDITOR.TRISTATE_ON &&\r
+ element.is( 'table' ) && ( !element.hasAttribute( 'border' ) || parseInt( element.getAttribute( 'border' ), 10 ) <= 0 ) )\r
+ element.addClass( showBorderClassName );\r
+ });\r
},\r
\r
afterInit : function( editor )\r
cssClass = attributes[ 'class' ],\r
border = parseInt( attributes.border, 10 );\r
\r
- if ( !border || border <= 0 )\r
+ if ( ( !border || border <= 0 ) && ( !cssClass || cssClass.indexOf( showBorderClassName ) == -1 ) )\r
attributes[ 'class' ] = ( cssClass || '' ) + ' ' + showBorderClassName;\r
}\r
}\r
selectedTable[ ( !value || value <= 0 ) ? 'addClass' : 'removeClass' ]( showBorderClassName );\r
};\r
} );\r
+\r
+ var advTab = dialogDefinition.getContents( 'advanced' ),\r
+ classField = advTab && advTab.get( 'advCSSClasses' );\r
+\r
+ if ( classField )\r
+ {\r
+ classField.setup = CKEDITOR.tools.override( classField.setup, function( originalSetup )\r
+ {\r
+ return function()\r
+ {\r
+ originalSetup.apply( this, arguments );\r
+ this.setValue( this.getValue().replace( /cke_show_border/, '' ) );\r
+ };\r
+ });\r
+\r
+ classField.commit = CKEDITOR.tools.override( classField.commit, function( originalCommit )\r
+ {\r
+ return function( data, element )\r
+ {\r
+ originalCommit.apply( this, arguments );\r
+\r
+ if ( !parseInt( element.getAttribute( 'border' ), 10 ) )\r
+ element.addClass( 'cke_show_border' );\r
+ };\r
+ });\r
+ }\r
}\r
});\r
\r
\r
/**\r
* Whether to automatically enable the "show borders" command when the editor loads.\r
+ * (ShowBorders in FCKeditor)\r
+ * @name CKEDITOR.config.startupShowBorders\r
* @type Boolean\r
* @default true\r
* @example\r