Ticket #6083: 6083_2.patch
File 6083_2.patch, 2.6 KB (added by , 13 years ago) |
---|
-
_source/plugins/wysiwygarea/plugin.js
30 30 { 31 31 if ( this.mode == 'wysiwyg' ) 32 32 { 33 this.focus();34 35 33 var selection = this.getSelection(); 36 34 if ( checkReadOnly( selection ) ) 37 35 return; … … 47 45 var selIsLocked = selection.isLocked; 48 46 49 47 if ( selIsLocked ) 50 selection.unlock( );48 selection.unlock(true); 51 49 52 50 var $sel = selection.getNative(); 53 51 … … 105 103 { 106 104 if ( this.mode == 'wysiwyg' ) 107 105 { 108 this.focus();109 110 106 var selection = this.getSelection(); 111 107 if ( checkReadOnly( selection ) ) 112 108 return; -
_source/plugins/selection/plugin.js
133 133 // point. 134 134 if ( savedRange ) 135 135 { 136 if ( restoreEnabled ) 136 // Range restored here might invalidate the DOM structure thus break up 137 // the locked selection. 138 var lockedSelection = doc.getCustomData( 'cke_locked_selection' ); 139 if ( restoreEnabled && !lockedSelection ) 137 140 { 138 141 // Well not break because of this. 139 142 try … … 412 415 */ 413 416 if ( CKEDITOR.env.ie ) 414 417 { 415 var range = this.getNative().createRange(); 416 if ( !range 417 || ( range.item && range.item(0).ownerDocument != this.document.$ ) 418 || ( range.parentElement && range.parentElement().ownerDocument != this.document.$ ) ) 419 { 420 this.isInvalid = true; 421 } 422 } 418 var i = 0; 419 while(1) 420 { 421 var range = this.getNative().createRange(); 422 if ( !range 423 || ( range.item && range.item(0).ownerDocument != this.document.$ ) 424 || ( range.parentElement && range.parentElement().ownerDocument != this.document.$ ) ) 425 { 426 // Maybe due to document unfocused, give it another try. 427 if ( !i++ ) 428 { 429 this.document.getWindow().focus(); 430 continue; 431 } 432 this.isInvalid = true; 433 } 434 break; 435 } 436 } 423 437 424 438 return this; 425 439 }; … … 972 986 973 987 if ( lockedSelection ) 974 988 { 975 doc.setCustomData( 'cke_locked_selection', null );976 977 989 if ( restore ) 978 990 { 979 991 var selectedElement = lockedSelection.getSelectedElement(), … … 989 1001 else 990 1002 this.selectRanges( ranges ); 991 1003 } 1004 doc.setCustomData( 'cke_locked_selection', null ); 992 1005 } 993 1006 994 1007 if ( !lockedSelection || !restore )