umd/fieldstack.js
/**
   * Attempt to insert composed characters into the document.
   *
   * If we are still in a composition session, do nothing. Otherwise, insert
   * the characters into the document and terminate the composition session.
   *
   * If no characters were composed -- for instance, the user
   * deleted all composed characters and committed nothing new --
   * force a re-render. We also re-render when the composition occurs
   * at the beginning of a leaf, to ensure that if the browser has
   * created a new text node for the composition, we will discard it.
   *
   * Resetting innerHTML will move focus to the beginning of the editor,
   * so we update to force it back to the correct place.
   */
Attempt to insert composed characters into the document.
If we are still in a composition session, do nothing. Otherwise, insert
the characters into the document and terminate the composition session.

If no characters were composed -- for instance, the user
deleted all composed characters and committed nothing new
force a re-render. We also re-render when the composition occurs
at the beginning of a leaf, to ensure that if the browser has
created a new text node for the composition, we will discard it.

Resetting innerHTML will move focus to the beginning of the editor,
so we update to force it back to the correct place.
Attempt to insert composed characters into the document . If we are still in a composition session do nothing . Otherwise insert the characters into the document and terminate the composition session . If no characters were composed -- for instance the user deleted all composed characters and committed nothing new force a re - render . We also re - render when the composition occurs at the beginning of a leaf to ensure that if the browser has created a new text node for the composition we will discard it . Resetting innerHTML will move focus to the beginning of the editor so we update to force it back to the correct place .
function resolveComposition(editor) {
    if (stillComposing) {
      return;
    }
    resolved = true;
    var composedChars = textInputData;
    textInputData = '';
    var editorState = EditorState_1.set(editor._latestEditorState, {
      inCompositionMode: false
    });
    var currentStyle = editorState.getCurrentInlineStyle();
    var entityKey = getEntityKeyForSelection_1(editorState.getCurrentContent(), editorState.getSelection());
    var mustReset = !composedChars || isSelectionAtLeafStart_1(editorState) || currentStyle.size > 0 || entityKey !== null;
    if (mustReset) {
      editor.restoreEditorDOM();
    }
    editor.exitCurrentMode();
    if (composedChars) {
      if (DraftFeatureFlags_1.draft_handlebeforeinput_composed_text && editor.props.handleBeforeInput && isEventHandled_1(editor.props.handleBeforeInput(composedChars, editorState))) {
        return;
      }
      var contentState = DraftModifier_1.replaceText(editorState.getCurrentContent(), editorState.getSelection(), composedChars, currentStyle, entityKey);
      editor.update(EditorState_1.push(editorState, contentState, 'insert-characters'));
      return;
    }
    if (mustReset) {
      editor.update(EditorState_1.set(editorState, {
        nativelyRenderedContent: null,
        forceSelection: true
      }));
    }
  }
function resolveComposition ( editor ) { if ( stillComposing ) { return ; } resolved = true ; var composedChars = textInputData ; textInputData = '' ; var editorState = EditorState_1 . set ( editor . _latestEditorState , { inCompositionMode : false } ) ; var currentStyle = editorState . getCurrentInlineStyle ( ) ; var entityKey = getEntityKeyForSelection_1 ( editorState . getCurrentContent ( ) , editorState . getSelection ( ) ) ; var mustReset = ! composedChars || isSelectionAtLeafStart_1 ( editorState ) || currentStyle . size > 0 || entityKey !== null ; if ( mustReset ) { editor . restoreEditorDOM ( ) ; } editor . exitCurrentMode ( ) ; if ( composedChars ) { if ( DraftFeatureFlags_1 . draft_handlebeforeinput_composed_text && editor . props . handleBeforeInput && isEventHandled_1 ( editor . props . handleBeforeInput ( composedChars , editorState ) ) ) { return ; } var contentState = DraftModifier_1 . replaceText ( editorState . getCurrentContent ( ) , editorState . getSelection ( ) , composedChars , currentStyle , entityKey ) ; editor . update ( EditorState_1 . push ( editorState , contentState , 'insert-characters' ) ) ; return ; } if ( mustReset ) { editor . update ( EditorState_1 . set ( editorState , { nativelyRenderedContent : null , forceSelection : true } ) ) ; } }
Attempt to insert composed characters into the document.
Attempt to insert composed characters into the document .
// If characters have been composed, re-rendering with the update // is sufficient to reset the editor.