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