Ticket #7437: 7437.patch
File 7437.patch, 1.9 KB (added by , 13 years ago) |
---|
-
_source/plugins/selection/plugin.js
186 186 } 187 187 }, null, null, 10 ); 188 188 189 var fillingCharBefore; 189 var fillingCharBefore, 190 resetSelection; 191 190 192 function beforeData() 191 193 { 192 var fillingChar = getFillingChar( editor.document ); 193 fillingCharBefore = fillingChar && fillingChar.getText(); 194 fillingCharBefore && fillingChar.setText( fillingCharBefore.replace( /\u200B/g, '' ) ); 195 } 194 var doc = editor.document, 195 fillingChar = getFillingChar( doc ); 196 197 if ( fillingChar ) 198 { 199 // If cursor is right blinking by side of the filler node, save it for restoring, 200 // as the following text substitution will blind it. (#7437) 201 var sel = doc.$.defaultView.getSelection(); 202 if ( sel.type == 'Caret' && sel.anchorNode == fillingChar.$ ) 203 resetSelection = 1; 204 205 fillingCharBefore = fillingChar.getText(); 206 fillingChar.setText( fillingCharBefore.replace( /\u200B/g, '' ) ); 207 } 208 } 196 209 function afterData() 197 210 { 198 var fillingChar = getFillingChar( editor.document ); 199 fillingChar && fillingChar.setText( fillingCharBefore ); 200 } 211 var doc = editor.document, 212 fillingChar = getFillingChar( doc ); 213 214 if ( fillingChar ) 215 { 216 fillingChar.setText( fillingCharBefore ); 217 218 if ( resetSelection ) 219 { 220 doc.$.defaultView.getSelection().setPosition( fillingChar.$,fillingChar.getLength() ); 221 resetSelection = 0; 222 } 223 } 224 } 201 225 editor.on( 'beforeUndoImage', beforeData ); 202 226 editor.on( 'afterUndoImage', afterData ); 203 227 editor.on( 'beforeGetData', beforeData, null, null, 0 );