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.

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