JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.6
[ckeditor.git] / _source / plugins / sourcearea / plugin.js
index ad3b4ea..4e9e0da 100644 (file)
@@ -41,6 +41,8 @@ CKEDITOR.plugins.add( 'sourcearea',
                                                        textarea.addClass( 'cke_source' );\r
                                                        textarea.addClass( 'cke_enable_context_menu' );\r
 \r
+                                                       editor.readOnly && textarea.setAttribute( 'readOnly', 'readonly' );\r
+\r
                                                        var styles =\r
                                                        {\r
                                                                // IE7 has overflow the <textarea> from wrapping table cell.\r
@@ -147,6 +149,17 @@ CKEDITOR.plugins.add( 'sourcearea',
                                        });\r
                        });\r
 \r
+               editor.on( 'readOnly', function()\r
+                       {\r
+                               if ( editor.mode == 'source' )\r
+                               {\r
+                                       if ( editor.readOnly )\r
+                                               editor.textarea.setAttribute( 'readOnly', 'readonly' );\r
+                                       else\r
+                                               editor.textarea.removeAttribute( 'readOnly' );\r
+                               }\r
+                       });\r
+\r
                editor.addCommand( 'source', sourcearea.commands.source );\r
 \r
                if ( editor.ui.addButton )\r
@@ -181,7 +194,7 @@ CKEDITOR.plugins.sourcearea =
                {\r
                        modes : { wysiwyg:1, source:1 },\r
                        editorFocus : false,\r
-\r
+                       readOnly : 1,\r
                        exec : function( editor )\r
                        {\r
                                if ( editor.mode == 'wysiwyg' )\r