X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fshowblocks%2Fplugin.js;h=de951246045b5c553b8aaf86b571427069c6ead6;hb=2f22c0c38f17e75be5541089076885442aaa2377;hp=6a5ebc263a37fc6ad0204c34e4d7ebcbf7b4ced2;hpb=ea7e3453c7b0f023b050aca6d9f83ab372860d91;p=ckeditor.git diff --git a/_source/plugins/showblocks/plugin.js b/_source/plugins/showblocks/plugin.js index 6a5ebc2..de95124 100644 --- a/_source/plugins/showblocks/plugin.js +++ b/_source/plugins/showblocks/plugin.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -24,9 +24,10 @@ For licensing, see LICENSE.html or http://ckeditor.com/license '.%2 h6'+ '{'+ 'background-repeat: no-repeat;'+ + 'background-position: top %3;'+ 'border: 1px dotted gray;'+ 'padding-top: 8px;'+ - 'padding-left: 8px;'+ + 'padding-%3: 8px;'+ '}'+ '.%2 p'+ @@ -84,11 +85,13 @@ For licensing, see LICENSE.html or http://ckeditor.com/license '%1h6.png);'+ '}'; - var cssTemplateRegex = /%1/g, cssClassRegex = /%2/g; + var cssTemplateRegex = /%1/g, cssClassRegex = /%2/g, backgroundPositionRegex = /%3/g; var commandDefinition = { + readOnly : 1, preserveState : true, + editorFocus : false, exec : function ( editor ) { @@ -98,8 +101,11 @@ For licensing, see LICENSE.html or http://ckeditor.com/license refresh : function( editor ) { - var funcName = ( this.state == CKEDITOR.TRISTATE_ON ) ? 'addClass' : 'removeClass'; - editor.document.getBody()[ funcName ]( 'cke_show_blocks' ); + if ( editor.document ) + { + var funcName = ( this.state == CKEDITOR.TRISTATE_ON ) ? 'addClass' : 'removeClass'; + editor.document.getBody()[ funcName ]( 'cke_show_blocks' ); + } } }; @@ -117,7 +123,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license editor.addCss( cssTemplate .replace( cssTemplateRegex, 'background-image: url(' + CKEDITOR.getUrl( this.path ) + 'images/block_' ) - .replace( cssClassRegex, 'cke_show_blocks ' ) ); + .replace( cssClassRegex, 'cke_show_blocks ' ) + .replace( backgroundPositionRegex, editor.lang.dir == 'rtl' ? 'right' : 'left' ) ); editor.ui.addButton( 'ShowBlocks', { @@ -144,10 +151,10 @@ For licensing, see LICENSE.html or http://ckeditor.com/license /** * Whether to automaticaly enable the "show block" command when the editor - * loads. + * loads. (StartupShowBlocks in FCKeditor) + * @name CKEDITOR.config.startupOutlineBlocks * @type Boolean * @default false * @example * config.startupOutlineBlocks = true; */ -CKEDITOR.config.startupOutlineBlocks = false;