File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change 206
206
evt . removeListener ( ) ;
207
207
208
208
if ( restoreSel !== 0 ) {
209
- var rng = editor . createRange ( ) ;
210
- rng . moveToElementEditStart ( editable ) ;
211
- rng . select ( ) ;
209
+ var native = editor . getSelection ( ) . getNative ( ) ;
210
+ // Do it only if the native selection is at an unwanted
211
+ // place (at the very start of the editable). #10119
212
+ // IEs<9 won't enter this if (no isCollapsed property on selection instance),
213
+ // but this is acceptable since they do a good job in terms of
214
+ // default selection positioning.
215
+ if ( native . isCollapsed && native . anchorNode == editable . $ ) {
216
+ var rng = editor . createRange ( ) ;
217
+ rng . moveToElementEditStart ( editable ) ;
218
+ rng . select ( ) ;
219
+ }
212
220
}
213
221
} , null , null , - 2 ) ;
214
222
}
Original file line number Diff line number Diff line change 88
88
89
89
90
90
function onClick ( elementIndex ) {
91
- editor . focus ( ) ;
92
91
var element = editor . _ . elementsPath . list [ elementIndex ] ;
93
92
if ( element . equals ( editor . editable ( ) ) ) {
94
93
var range = editor . createRange ( ) ;
95
94
range . selectNodeContents ( element ) ;
96
95
range . select ( ) ;
97
96
} else
98
97
editor . getSelection ( ) . selectElement ( element ) ;
98
+
99
+ // It is important to focus() *after* the above selection
100
+ // manipulation, otherwise Firefox will have troubles. #10119
101
+ editor . focus ( ) ;
99
102
}
100
103
101
104
var onClickHanlder = CKEDITOR . tools . addFunction ( onClick ) ;
You can’t perform that action at this time.
0 commit comments