Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 

33 Zeilen
876 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. *
  9. * @emails oncall+draft_js
  10. */
  11. 'use strict';
  12. var getFragmentFromSelection = require("./getFragmentFromSelection");
  13. /**
  14. * If we have a selection, create a ContentState fragment and store
  15. * it in our internal clipboard. Subsequent paste events will use this
  16. * fragment if no external clipboard data is supplied.
  17. */
  18. function editOnCopy(editor, e) {
  19. var editorState = editor._latestEditorState;
  20. var selection = editorState.getSelection(); // No selection, so there's nothing to copy.
  21. if (selection.isCollapsed()) {
  22. e.preventDefault();
  23. return;
  24. }
  25. editor.setClipboard(getFragmentFromSelection(editor._latestEditorState));
  26. }
  27. module.exports = editOnCopy;