JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.6.2
[ckeditor.git] / _source / plugins / basicstyles / plugin.js
index 8bcd1e4..6ad08b0 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
 For licensing, see LICENSE.html or http://ckeditor.com/license\r
 */\r
 \r
@@ -17,7 +17,7 @@ CKEDITOR.plugins.add( 'basicstyles',
 \r
                        editor.attachStyleStateChange( style, function( state )\r
                                {\r
-                                       editor.getCommand( commandName ).setState( state );\r
+                                       !editor.readOnly && editor.getCommand( commandName ).setState( state );\r
                                });\r
 \r
                        editor.addCommand( commandName, new CKEDITOR.styleCommand( style ) );\r
@@ -29,73 +29,101 @@ CKEDITOR.plugins.add( 'basicstyles',
                                });\r
                };\r
 \r
-               var config = editor.config;\r
-               var lang = editor.lang;\r
+               var config = editor.config,\r
+                       lang = editor.lang;\r
 \r
-               addButtonCommand( 'Bold'                , lang.bold                     , 'bold'                , config.coreStyles_bold );\r
+               addButtonCommand( 'Bold'                , lang.bold             , 'bold'                , config.coreStyles_bold );\r
                addButtonCommand( 'Italic'              , lang.italic           , 'italic'              , config.coreStyles_italic );\r
-               addButtonCommand( 'Underline'   , lang.underline        , 'underline'   , config.coreStyles_underline );\r
+               addButtonCommand( 'Underline'   , lang.underline                , 'underline'   , config.coreStyles_underline );\r
                addButtonCommand( 'Strike'              , lang.strike           , 'strike'              , config.coreStyles_strike );\r
-               addButtonCommand( 'Subscript'   , lang.subscript        , 'subscript'   , config.coreStyles_subscript );\r
-               addButtonCommand( 'Superscript' , lang.superscript      , 'superscript' , config.coreStyles_superscript );\r
+               addButtonCommand( 'Subscript'   , lang.subscript                , 'subscript'   , config.coreStyles_subscript );\r
+               addButtonCommand( 'Superscript' , lang.superscript              , 'superscript' , config.coreStyles_superscript );\r
        }\r
 });\r
 \r
 // Basic Inline Styles.\r
 \r
 /**\r
- * The style definition to be used to apply the bold style in the text.\r
+ * The style definition that applies the <strong>bold</strong> style to the text.\r
  * @type Object\r
+ * @default <code>{ element : 'strong', overrides : 'b' }</code>\r
  * @example\r
  * config.coreStyles_bold = { element : 'b', overrides : 'strong' };\r
  * @example\r
- * config.coreStyles_bold = { element : 'span', attributes : {'class': 'Bold'} };\r
+ * config.coreStyles_bold =\r
+ *     {\r
+ *         element : 'span',\r
+ *         attributes : { 'class' : 'Bold' }\r
+ *     };\r
  */\r
 CKEDITOR.config.coreStyles_bold = { element : 'strong', overrides : 'b' };\r
 \r
 /**\r
- * The style definition to be used to apply the italic style in the text.\r
+ * The style definition that applies the <em>italics</em> style to the text.\r
  * @type Object\r
- * @default { element : 'em', overrides : 'i' }\r
+ * @default <code>{ element : 'em', overrides : 'i' }</code>\r
  * @example\r
- * config.coreStyles_bold = { element : 'i', overrides : 'em' };\r
+ * config.coreStyles_italic = { element : 'i', overrides : 'em' };\r
  * @example\r
- * CKEDITOR.config.coreStyles_italic = { element : 'span', attributes : {'class': 'Italic'} };\r
+ * CKEDITOR.config.coreStyles_italic =\r
+ *     {\r
+ *         element : 'span',\r
+ *         attributes : { 'class' : 'Italic' }\r
+ *     };\r
  */\r
 CKEDITOR.config.coreStyles_italic = { element : 'em', overrides : 'i' };\r
 \r
 /**\r
- * The style definition to be used to apply the underline style in the text.\r
+ * The style definition that applies the <u>underline</u> style to the text.\r
  * @type Object\r
- * @default { element : 'u' }\r
+ * @default <code>{ element : 'u' }</code>\r
  * @example\r
- * CKEDITOR.config.coreStyles_underline = { element : 'span', attributes : {'class': 'Underline'}};\r
+ * CKEDITOR.config.coreStyles_underline =\r
+ *     {\r
+ *         element : 'span',\r
+ *         attributes : { 'class' : 'Underline' }\r
+ *     };\r
  */\r
 CKEDITOR.config.coreStyles_underline = { element : 'u' };\r
 \r
 /**\r
- * The style definition to be used to apply the strike style in the text.\r
+ * The style definition that applies the <strike>strike-through</strike> style to the text.\r
  * @type Object\r
- * @default { element : 'strike' }\r
+ * @default <code>{ element : 'strike' }</code>\r
  * @example\r
- * CKEDITOR.config.coreStyles_strike = { element : 'span', attributes : {'class': 'StrikeThrough'}, overrides : 'strike' };\r
+ * CKEDITOR.config.coreStyles_strike =\r
+ *     {\r
+ *         element : 'span',\r
+ *         attributes : { 'class' : 'StrikeThrough' },\r
+ *         overrides : 'strike'\r
+ *     };\r
  */\r
 CKEDITOR.config.coreStyles_strike = { element : 'strike' };\r
 \r
 /**\r
- * The style definition to be used to apply the subscript style in the text.\r
+ * The style definition that applies the subscript style to the text.\r
  * @type Object\r
- * @default { element : 'sub' }\r
+ * @default <code>{ element : 'sub' }</code>\r
  * @example\r
- * CKEDITOR.config.coreStyles_subscript = { element : 'span', attributes : {'class': 'Subscript'}, overrides : 'sub' };\r
+ * CKEDITOR.config.coreStyles_subscript =\r
+ *     {\r
+ *         element : 'span',\r
+ *         attributes : { 'class' : 'Subscript' },\r
+ *         overrides : 'sub'\r
+ *     };\r
  */\r
 CKEDITOR.config.coreStyles_subscript = { element : 'sub' };\r
 \r
 /**\r
- * The style definition to be used to apply the superscript style in the text.\r
+ * The style definition that applies the superscript style to the text.\r
  * @type Object\r
- * @default { element : 'sup' }\r
+ * @default <code>{ element : 'sup' }</code>\r
  * @example\r
- * CKEDITOR.config.coreStyles_superscript = { element : 'span', attributes : {'class': 'Superscript'}, overrides : 'sup' };\r
+ * CKEDITOR.config.coreStyles_superscript =\r
+ *     {\r
+ *         element : 'span',\r
+ *         attributes : { 'class' : 'Superscript' },\r
+ *         overrides : 'sup'\r
+ *     };\r
  */\r
 CKEDITOR.config.coreStyles_superscript = { element : 'sup' };\r