- 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
-\r
- // Create an invisible element to grab focus.\r
- if ( CKEDITOR.env.gecko || CKEDITOR.env.ie || CKEDITOR.env.opera )\r
- {\r
- var focusGrabber;\r
- editor.on( 'uiReady', function()\r
- {\r
- focusGrabber = editor.container.append( CKEDITOR.dom.element.createFromHtml(\r
- // Use 'span' instead of anything else to fly under the screen-reader radar. (#5049)\r
- '<span tabindex="-1" style="position:absolute;" role="presentation"></span>' ) );\r
-\r
- focusGrabber.on( 'focus', function()\r
- {\r
- editor.focus();\r
- } );\r
-\r
- editor.focusGrabber = focusGrabber;\r
- } );\r
- editor.on( 'destroy', function()\r
- {\r
- CKEDITOR.tools.removeFunction( contentDomReadyHandler );\r
- focusGrabber.clearCustomData();\r
- delete editor.focusGrabber;\r
- } );\r