Ticket #5782: 5782_2.patch
File 5782_2.patch, 1.7 KB (added by , 14 years ago) |
---|
-
_source/plugins/wysiwygarea/plugin.js
492 492 domWindow.on( 'focus', function() 493 493 { 494 494 var doc = editor.document; 495 if ( CKEDITOR.env.gecko || CKEDITOR.env.opera ) 495 496 if ( CKEDITOR.env.gecko ) 497 blinkCursor(); 498 else if ( CKEDITOR.env.opera ) 496 499 doc.getBody().focus(); 497 500 else if ( CKEDITOR.env.webkit ) 498 501 { … … 819 822 editor.addCss( 'html.CSS1Compat [contenteditable=false]{ min-height:0 !important;}' ); 820 823 821 824 // Switch on design mode for a short while and close it after then. 822 function blinkCursor( )825 function blinkCursor( retry ) 823 826 { 824 editor.document.$.designMode = 'on'; 825 setTimeout( function () 826 { 827 editor.document.$.designMode = 'off'; 828 }, 50 ); 827 CKEDITOR.tools.tryThese( function () 828 { 829 editor.document.$.designMode = 'on'; 830 setTimeout( function () 831 { 832 editor.document.$.designMode = 'off'; 833 editor.document.getBody().focus(); 834 }, 50 ); 835 }, function () 836 { 837 // The above call is known to fail when parent DOM 838 // tree layout changes may break design mode. (#5782) 839 // Refresh the 'contentEditable' is a cue to this. 840 editor.document.$.designMode = 'off'; 841 var body = editor.document.getBody(); 842 body.setAttribute( 'contentEditable', false ); 843 body.setAttribute( 'contentEditable', true ); 844 // Try it again once.. 845 !retry && blinkCursor( 1 ); 846 }) 829 847 } 830 848 831 849 // Create an invisible element to grab focus.