X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fshowborders%2Fplugin.js;h=46f2b28bc6905986a5615c7f734ebb6c9de533af;hb=9afde8772159bd3436f1f5b7862960307710ae5a;hp=5987be733e1fe136866cf2bf116765baf14b5c0d;hpb=e7789c1ad838194d45eeee6ac2eb6e55f5cf35a1;p=ckeditor.git diff --git a/_source/plugins/showborders/plugin.js b/_source/plugins/showborders/plugin.js index 5987be7..46f2b28 100644 --- a/_source/plugins/showborders/plugin.js +++ b/_source/plugins/showborders/plugin.js @@ -83,6 +83,14 @@ For licensing, see LICENSE.html or http://ckeditor.com/license if ( command.state != CKEDITOR.TRISTATE_DISABLED ) command.refresh( editor ); }); + + editor.on( 'removeFormatCleanup', function( evt ) + { + var element = evt.data; + if ( editor.getCommand( 'showborders' ).state == CKEDITOR.TRISTATE_ON && + element.is( 'table' ) && ( !element.hasAttribute( 'border' ) || parseInt( element.getAttribute( 'border' ), 10 ) <= 0 ) ) + element.addClass( showBorderClassName ); + }); }, afterInit : function( editor ) @@ -153,6 +161,32 @@ For licensing, see LICENSE.html or http://ckeditor.com/license selectedTable[ ( !value || value <= 0 ) ? 'addClass' : 'removeClass' ]( showBorderClassName ); }; } ); + + var advTab = dialogDefinition.getContents( 'advanced' ), + classField = advTab && advTab.get( 'advCSSClasses' ); + + if ( classField ) + { + classField.setup = CKEDITOR.tools.override( classField.setup, function( originalSetup ) + { + return function() + { + originalSetup.apply( this, arguments ); + this.setValue( this.getValue().replace( /cke_show_border/, '' ) ); + }; + }); + + classField.commit = CKEDITOR.tools.override( classField.commit, function( originalCommit ) + { + return function( data, element ) + { + originalCommit.apply( this, arguments ); + + if ( !parseInt( element.getAttribute( 'border' ), 10 ) ) + element.addClass( 'cke_show_border' ); + }; + }); + } } }); @@ -160,6 +194,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license /** * Whether to automatically enable the "show borders" command when the editor loads. + * (ShowBorders in FCKeditor) + * @name CKEDITOR.config.startupShowBorders * @type Boolean * @default true * @example