File tree 2 files changed +12
-7
lines changed
src/component/handlers/composition
2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -113,14 +113,19 @@ class DOMObserver {
113
113
return target . textContent ;
114
114
}
115
115
} else if ( type === 'childList' ) {
116
- // `characterData` events won't happen or are ignored when
117
- // removing the last character of a leaf node, what happens
118
- // instead is a `childList` event with a `removedNodes` array.
119
- // For this case the textContent should be '' and
120
- // `DraftModifier.replaceText` will make sure the content is
121
- // updated properly.
122
116
if ( removedNodes && removedNodes . length ) {
117
+ // `characterData` events won't happen or are ignored when
118
+ // removing the last character of a leaf node, what happens
119
+ // instead is a `childList` event with a `removedNodes` array.
120
+ // For this case the textContent should be '' and
121
+ // `DraftModifier.replaceText` will make sure the content is
122
+ // updated properly.
123
123
return '' ;
124
+ } else if ( target . textContent !== '' ) {
125
+ // Typing Chinese in an empty block in MS Edge results in a
126
+ // `childList` event with non-empty textContent.
127
+ // See https://github.com/facebook/draft-js/issues/2082
128
+ return target . textContent;
124
129
}
125
130
}
126
131
return null ;
Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ function getEditorStateFromHTML(html: string) {
67
67
const state =
68
68
blocksFromHTML != null
69
69
? ContentState . createFromBlockArray (
70
- blocksFromHTML . contentBlocks ?? [ ] ,
70
+ blocksFromHTML . contentBlocks || [ ] ,
71
71
blocksFromHTML . entityMap ,
72
72
)
73
73
: ContentState . createEmpty ( ) ;
You can’t perform that action at this time.
0 commit comments