File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed
src/component/handlers/composition Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -113,14 +113,19 @@ class DOMObserver {
113113 return target . textContent ;
114114 }
115115 } 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.
122116 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.
123123 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;
124129 }
125130 }
126131 return null ;
Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ function getEditorStateFromHTML(html: string) {
6767 const state =
6868 blocksFromHTML != null
6969 ? ContentState . createFromBlockArray (
70- blocksFromHTML . contentBlocks ?? [ ] ,
70+ blocksFromHTML . contentBlocks || [ ] ,
7171 blocksFromHTML . entityMap ,
7272 )
7373 : ContentState . createEmpty ( ) ;
You can’t perform that action at this time.
0 commit comments