@@ -18,13 +18,16 @@ const DraftModifier = require('DraftModifier');
18
18
const DraftOffsetKey = require ( 'DraftOffsetKey' ) ;
19
19
const EditorState = require ( 'EditorState' ) ;
20
20
const Keys = require ( 'Keys' ) ;
21
+ const UserAgent = require ( 'UserAgent' ) ;
21
22
22
23
const editOnSelect = require ( 'editOnSelect' ) ;
23
24
const getContentEditableContainer = require ( 'getContentEditableContainer' ) ;
24
25
const getDraftEditorSelection = require ( 'getDraftEditorSelection' ) ;
25
26
const getEntityKeyForSelection = require ( 'getEntityKeyForSelection' ) ;
26
27
const nullthrows = require ( 'nullthrows' ) ;
27
28
29
+ const isIE = UserAgent . isBrowser ( 'IE' ) ;
30
+
28
31
/**
29
32
* Millisecond delay to allow `compositionstart` to fire again upon
30
33
* `compositionend`.
@@ -225,10 +228,14 @@ const DraftEditorCompositionHandler = {
225
228
226
229
editor . restoreEditorDOM ( ) ;
227
230
228
- const editorStateWithUpdatedSelection = EditorState . acceptSelection (
229
- editorState ,
230
- compositionEndSelectionState ,
231
- ) ;
231
+ // See:
232
+ // - https://github.com/facebook/draft-js/issues/2093
233
+ // - https://github.com/facebook/draft-js/pull/2094
234
+ // Apply this fix only in IE for now. We can test it in
235
+ // other browsers in the future to ensure no regressions
236
+ const editorStateWithUpdatedSelection = isIE
237
+ ? EditorState . forceSelection ( editorState , compositionEndSelectionState )
238
+ : EditorState . acceptSelection ( editorState , compositionEndSelectionState ) ;
232
239
233
240
editor . update (
234
241
EditorState . push (
0 commit comments