+ editor.on( 'readOnly', function()\r
+ {\r
+ if ( editor.mode == 'wysiwyg' )\r
+ {\r
+ // Symply reload the wysiwyg area. It'll take care of read-only.\r
+ var wysiwyg = editor.getMode();\r
+ wysiwyg.loadData( wysiwyg.getData() );\r
+ }\r
+ });\r
+\r
+ // IE>=8 stricts mode doesn't have 'contentEditable' in effect\r
+ // on element unless it has layout. (#5562)\r
+ if ( CKEDITOR.document.$.documentMode >= 8 )\r
+ {\r
+ editor.addCss( 'html.CSS1Compat [contenteditable=false]{ min-height:0 !important;}' );\r
+\r
+ var selectors = [];\r
+ for ( var tag in CKEDITOR.dtd.$removeEmpty )\r
+ selectors.push( 'html.CSS1Compat ' + tag + '[contenteditable=false]' );\r
+ editor.addCss( selectors.join( ',' ) + '{ display:inline-block;}' );\r
+ }\r
+ // Set the HTML style to 100% to have the text cursor in affect (#6341)\r
+ else if ( CKEDITOR.env.gecko )\r
+ {\r
+ editor.addCss( 'html { height: 100% !important; }' );\r
+ editor.addCss( 'img:-moz-broken { -moz-force-broken-image-icon : 1; width : 24px; height : 24px; }' );\r
+ }\r
+\r
+ /* #3658: [IE6] Editor document has horizontal scrollbar on long lines\r
+ To prevent this misbehavior, we show the scrollbar always */\r
+ /* #6341: The text cursor must be set on the editor area. */\r
+ /* #6632: Avoid having "text" shape of cursor in IE7 scrollbars.*/\r
+ editor.addCss( 'html { _overflow-y: scroll; cursor: text; *cursor:auto;}' );\r
+ // Use correct cursor for these elements\r
+ editor.addCss( 'img, input, textarea { cursor: default;}' );\r
+\r
+ // Switch on design mode for a short while and close it after then.\r
+ function blinkCursor( retry )\r
+ {\r
+ if ( editor.readOnly )\r
+ return;\r
+\r
+ CKEDITOR.tools.tryThese(\r
+ function()\r
+ {\r
+ editor.document.$.designMode = 'on';\r
+ setTimeout( function()\r
+ {\r
+ editor.document.$.designMode = 'off';\r
+ if ( CKEDITOR.currentInstance == editor )\r
+ editor.document.getBody().focus();\r
+ }, 50 );\r
+ },\r
+ function()\r
+ {\r
+ // The above call is known to fail when parent DOM\r
+ // tree layout changes may break design mode. (#5782)\r
+ // Refresh the 'contentEditable' is a cue to this.\r
+ editor.document.$.designMode = 'off';\r
+ var body = editor.document.getBody();\r
+ body.setAttribute( 'contentEditable', false );\r
+ body.setAttribute( 'contentEditable', true );\r
+ // Try it again once..\r
+ !retry && blinkCursor( 1 );\r
+ });\r
+ }\r