Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

3 лет назад
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 UserAgent = require("fbjs/lib/UserAgent");
  14. const onBeforeInput = require("./editOnBeforeInput");
  15. const onBlur = require("./editOnBlur");
  16. const onCompositionStart = require("./editOnCompositionStart");
  17. const onCopy = require("./editOnCopy");
  18. const onCut = require("./editOnCut");
  19. const onDragOver = require("./editOnDragOver");
  20. const onDragStart = require("./editOnDragStart");
  21. const onFocus = require("./editOnFocus");
  22. const onInput = require("./editOnInput");
  23. const onKeyDown = require("./editOnKeyDown");
  24. const onPaste = require("./editOnPaste");
  25. const onSelect = require("./editOnSelect");
  26. const isChrome = UserAgent.isBrowser('Chrome');
  27. const selectionHandler: (e: DraftEditor) => void = isChrome ? onSelect : e => {};
  28. const DraftEditorEditHandler = {
  29. onBeforeInput,
  30. onBlur,
  31. onCompositionStart,
  32. onCopy,
  33. onCut,
  34. onDragOver,
  35. onDragStart,
  36. onFocus,
  37. onInput,
  38. onKeyDown,
  39. onPaste,
  40. onSelect,
  41. // In certain cases, contenteditable on chrome does not fire the onSelect
  42. // event, causing problems with cursor positioning. Therefore, the selection
  43. // state update handler is added to more events to ensure that the selection
  44. // state is always synced with the actual cursor positions.
  45. onMouseUp: selectionHandler,
  46. onKeyUp: selectionHandler
  47. };
  48. module.exports = DraftEditorEditHandler;