You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

31 lines
881 B

  1. /**
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. *
  7. * @format
  8. * @flow strict-local
  9. * @emails oncall+draft_js
  10. */
  11. 'use strict';
  12. import type DraftEditor from "./DraftEditor.react";
  13. const EditorState = require("./EditorState");
  14. /**
  15. * The user has begun using an IME input system. Switching to `composite` mode
  16. * allows handling composition input and disables other edit behavior.
  17. */
  18. function editOnCompositionStart(editor: DraftEditor, e: SyntheticEvent<>): void {
  19. editor.setMode('composite');
  20. editor.update(EditorState.set(editor._latestEditorState, {
  21. inCompositionMode: true
  22. })); // Allow composition handler to interpret the compositionstart event
  23. editor._onCompositionStart(e);
  24. }
  25. module.exports = editOnCompositionStart;