JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.3.1
[ckeditor.git] / _source / plugins / wysiwygarea / plugin.js
index ed278c7..5a0aca8 100644 (file)
@@ -478,7 +478,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                // the focus.\r
                                                                if ( evt.data.getTarget().equals( htmlElement ) )\r
                                                                {\r
-                                                                       CKEDITOR.env.gecko && blinkCursor();\r
+                                                                       if ( CKEDITOR.env.gecko && CKEDITOR.env.version >= 10900 )\r
+                                                                               blinkCursor();\r
                                                                        focusGrabber.focus();\r
                                                                }\r
                                                        } );\r
@@ -492,7 +493,10 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                domWindow.on( 'focus', function()\r
                                                        {\r
                                                                var doc = editor.document;\r
-                                                               if ( CKEDITOR.env.gecko || CKEDITOR.env.opera )\r
+\r
+                                                               if ( CKEDITOR.env.gecko && CKEDITOR.env.version >= 10900 )\r
+                                                                       blinkCursor();\r
+                                                               else if ( CKEDITOR.env.opera )\r
                                                                        doc.getBody().focus();\r
                                                                else if ( CKEDITOR.env.webkit )\r
                                                                {\r
@@ -707,8 +711,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                                config.docType +\r
                                                                                '<html dir="' + config.contentsLangDirection + '"' +\r
                                                                                        ' lang="' + ( config.contentsLanguage || editor.langCode ) + '">' +\r
-                                                                               '<title>' + frameLabel + '</title>' +\r
                                                                                '<head>' +\r
+                                                                                       '<title>' + frameLabel + '</title>' +\r
                                                                                        baseTag +\r
                                                                                        headExtra +\r
                                                                                '</head>' +\r
@@ -815,17 +819,41 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
 \r
                        // IE8 stricts mode doesn't have 'contentEditable' in effect\r
                        // on element unless it has layout. (#5562)\r
-                       if ( CKEDITOR.env.ie8 )\r
+                       if ( CKEDITOR.env.ie8Compat )\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
+\r
                        // Switch on design mode for a short while and close it after then.\r
-                       function blinkCursor()\r
+                       function blinkCursor( retry )\r
                        {\r
-                               editor.document.$.designMode = 'on';\r
-                               setTimeout( function ()\r
-                               {\r
-                                       editor.document.$.designMode = 'off';\r
-                               }, 50 );\r
+                               CKEDITOR.tools.tryThese(\r
+                                       function()\r
+                                       {\r
+                                               editor.document.$.designMode = 'on';\r
+                                               setTimeout( function ()\r
+                                               {\r
+                                                       editor.document.$.designMode = 'off';\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
 \r
                        // Create an invisible element to grab focus.\r