Ticket #5735: 5735_2.patch
File 5735_2.patch, 2.5 KB (added by , 15 years ago) |
---|
-
_source/plugins/selection/plugin.js
105 105 editor.on( 'contentDom', function() 106 106 { 107 107 var doc = editor.document, 108 body = doc.getBody(); 108 body = doc.getBody(), 109 html = doc.getDocumentElement(); 109 110 110 111 if ( CKEDITOR.env.ie ) 111 112 { … … 115 116 // than firing the selection change event. 116 117 117 118 var savedRange, 118 saveEnabled; 119 saveEnabled, 120 restoreEnabled = 1; 119 121 120 122 // "onfocusin" is fired before "onfocus". It makes it 121 123 // possible to restore the selection before click … … 131 133 // point. 132 134 if ( savedRange ) 133 135 { 134 // Well not break because of this. 135 try 136 if ( restoreEnabled ) 136 137 { 137 savedRange.select(); 138 // Well not break because of this. 139 try 140 { 141 savedRange.select(); 142 } 143 catch (e) 144 {} 138 145 } 139 catch (e)140 {}141 146 142 147 savedRange = null; 143 148 } … … 160 165 161 166 // Disable selections from being saved. 162 167 saveEnabled = false; 168 restoreEnabled = 1; 163 169 }); 164 170 165 171 // IE before version 8 will leave cursor blinking inside the document after 166 172 // editor blurred unless we clean up the selection. (#4716) 167 173 if ( CKEDITOR.env.ie && CKEDITOR.env.version < 8 ) 168 174 { 169 doc.getWindow().on( 'blur', function( evt )175 editor.on( 'blur', function( evt ) 170 176 { 171 177 editor.document.$.selection.empty(); 172 178 }); 173 179 } 174 180 181 // Listening on document element ensures that 182 // scrollbar is included. (#5280) 183 html.on( 'mousedown', function () 184 { 185 // Lock restore selection now, as we have 186 // a followed 'click' event which introduce 187 // new selection. (#5735) 188 restoreEnabled = 0; 189 }); 190 191 html.on( 'mouseup', function () 192 { 193 restoreEnabled = 1; 194 }); 195 175 196 // IE fires the "selectionchange" event when clicking 176 197 // inside a selection. We don't want to capture that. 177 body.on( 'mousedown', disableSave ); 198 body.on( 'mousedown', function () 199 { 200 disableSave(); 201 }); 202 178 203 body.on( 'mouseup', 179 204 function() 180 205 {