Ticket #3028: 3028_heavy.patch
File 3028_heavy.patch, 5.7 KB (added by , 14 years ago) |
---|
-
_source/plugins/editingblock/plugin.js
40 40 editor.on( 'uiReady', function() 41 41 { 42 42 editor.setMode( editor.config.startupMode ); 43 44 if ( editor.config.startupFocus )45 editor.focus();46 43 }); 47 44 48 45 editor.on( 'afterSetData', function() … … 98 95 // Do that once only. 99 96 event.removeListener(); 100 97 98 if ( editor.config.startupFocus ) 99 editor.focus(); 100 101 101 // Grab editor focus if the editor container is focused. (#3104) 102 102 editor.container.on( 'focus', function() 103 103 { 104 104 editor.focus(); 105 105 }); 106 106 107 if ( editor.config.onLoad ) 108 editor.config.onLoad( editor ); 109 107 110 // Fire instanceReady for both the editor and CKEDITOR. 108 111 editor.fireOnce( 'instanceReady' ); 109 112 CKEDITOR.fire( 'instanceReady', null, editor ); -
_source/plugins/sourcearea/plugin.js
18 18 19 19 editor.on( 'editingBlockReady', function() 20 20 { 21 var textarea; 21 var textarea, 22 checkFocusTimes = editor.config.startupMode == 'source' ? 10 : 0; // Check startup focus 10 times. 22 23 23 24 editor.addMode( 'source', 24 25 { … … 73 74 // Set the <textarea> value. 74 75 this.loadData( data ); 75 76 76 var keystrokeHandler = editor.keystrokeHandler; 77 if ( keystrokeHandler ) 78 keystrokeHandler.attach( textarea ); 77 var addHandlers = function( ) 78 { 79 textarea.on( 'blur', function() 80 { 81 editor.focusManager.blur(); 82 }); 79 83 80 editor.mode = 'source'; 81 editor.fire( 'mode' ); 84 textarea.on( 'focus', function() 85 { 86 editor.focusManager.focus(); 87 } ); 88 } 89 if ( CKEDITOR.env.ie ) 90 addHandlers(); 91 92 var textareaReady = function() 93 { 94 var keystrokeHandler = editor.keystrokeHandler; 95 if ( keystrokeHandler ) 96 keystrokeHandler.attach( textarea ); 97 98 if ( !CKEDITOR.env.ie ) 99 addHandlers(); 100 101 editor.mode = 'source'; 102 editor.fire( 'mode' ); 103 }; 104 105 if ( checkFocusTimes > 0 ) // Only once, if startupFocus is set. 106 { 107 // Check if the startup focus was set. If so - fire 'mode' event. 108 var checkFocus = function() 109 { 110 if ( checkFocusTimes <= 0 || !editor.config.startupFocus ) // Element is ready 111 { 112 textarea.$.blur(); // Startup focus is set in 'mode' listener. 113 textareaReady(); 114 } 115 else 116 { 117 try {textarea.$.focus();}catch ( e ){} // Use 'try' due to IE bug. 118 119 checkFocusTimes--; 120 setTimeout( checkFocus, 200 ); 121 } 122 }; 123 124 textarea.on( 'focus', function( event ) 125 { 126 checkFocusTimes = 0; 127 event.removeListener(); 128 }, textarea ); 129 130 checkFocus(); 131 } 132 else 133 textareaReady(); 82 134 }, 83 135 84 136 loadData : function( data ) -
_source/plugins/wysiwygarea/plugin.js
102 102 iframe, 103 103 isLoadingData, 104 104 isPendingFocus, 105 fireMode; 105 fireMode, 106 checkFocusTimes = editor.config.startupMode == 'wysiwyg' ? 10 : 0; // Check startup focus 10 times. 106 107 107 108 // The following information is needed for IE only. 108 109 var isCustomDomain = CKEDITOR.env.ie && document.domain != window.location.hostname; … … 224 225 domWindow = editor.window = new CKEDITOR.dom.window( domWindow ); 225 226 domDocument = editor.document = new CKEDITOR.dom.document( domDocument ); 226 227 227 var focusTarget = ( CKEDITOR.env.ie || CKEDITOR.env. safari) ?228 var focusTarget = ( CKEDITOR.env.ie || CKEDITOR.env.webkit ) ? 228 229 domWindow : domDocument; 229 230 230 231 focusTarget.on( 'blur', function() … … 247 248 if ( editor.contextMenu ) 248 249 editor.contextMenu.addTarget( domDocument ); 249 250 250 if ( fireMode ) 251 isLoadingData = false; 252 253 var documentReady = function() 251 254 { 252 editor.mode = 'wysiwyg'; 253 editor.fire( 'mode' ); 254 fireMode = false; 255 } 255 if ( fireMode ) 256 { 257 editor.mode = 'wysiwyg'; 258 editor.fire( 'mode' ); 259 fireMode = false; 260 } 256 261 257 isLoadingData = false; 262 if ( isPendingFocus ) 263 editor.focus(); 264 }; 265 266 if ( editor.config.startupFocus && ( CKEDITOR.env.ie || CKEDITOR.env.opera ) && checkFocusTimes > 0 ) 267 { 268 // #3028. Check if the startup focus was set. If so - element is ready. 269 var checkFocus = function() 270 { 271 if ( checkFocusTimes <= 0 ) 272 documentReady(); 273 else 274 { 275 editor.window.focus(); 276 checkFocusTimes--; 277 setTimeout( checkFocus, 200 ); 278 } 279 }; 258 280 259 if ( isPendingFocus ) 260 editor.focus(); 281 focusTarget.on( 'focus', function( event ) 282 { 283 checkFocusTimes = 0; 284 event.removeListener(); 285 }, focusTarget ); 286 287 checkFocus(); 288 } 289 else 290 documentReady(); 261 291 }; 262 292 263 293 editor.addMode( 'wysiwyg',