File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -238,7 +238,7 @@ class Syntax extends Module {
238
238
container . highlight ( this . highlightBlot , force ) ;
239
239
} ) ;
240
240
this . quill . update ( Quill . sources . SILENT ) ;
241
- if ( range != null ) {
241
+ if ( range != null && this . quill . hasFocus ( ) ) {
242
242
this . quill . setSelection ( range , Quill . sources . SILENT ) ;
243
243
}
244
244
}
Original file line number Diff line number Diff line change @@ -287,6 +287,17 @@ describe('Syntax', function () {
287
287
) ;
288
288
} ) ;
289
289
290
+ it ( 'should not call selection change if editor is not focused to not refocus (T1233316)' , function ( ) {
291
+ this . quill . setSelection ( 1 , 1 ) ;
292
+ this . quill . root . blur ( ) ;
293
+
294
+ const setSelectionSpy = spyOn ( this . quill , 'setSelection' ) ;
295
+ this . quill . getModule ( 'syntax' ) . highlight ( ) ;
296
+
297
+ expect ( setSelectionSpy ) . not . toHaveBeenCalled ( ) ;
298
+ setSelectionSpy . calls . reset ( ) ;
299
+ } ) ;
300
+
290
301
describe ( 'allowedChildren' , function ( ) {
291
302
beforeAll ( function ( ) {
292
303
SyntaxCodeBlock . allowedChildren . push ( BoldBlot ) ;
You can’t perform that action at this time.
0 commit comments