import { __require as requireGetFragmentFromSelection } from './getFragmentFromSelection.js';

/**
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @format
 * 
 * @emails oncall+draft_js
 */

var editOnCopy_1;
var hasRequiredEditOnCopy;

function requireEditOnCopy () {
	if (hasRequiredEditOnCopy) return editOnCopy_1;
	hasRequiredEditOnCopy = 1;

	var getFragmentFromSelection = requireGetFragmentFromSelection();
	/**
	 * If we have a selection, create a ContentState fragment and store
	 * it in our internal clipboard. Subsequent paste events will use this
	 * fragment if no external clipboard data is supplied.
	 */


	function editOnCopy(editor, e) {
	  var editorState = editor._latestEditorState;
	  var selection = editorState.getSelection(); // No selection, so there's nothing to copy.

	  if (selection.isCollapsed()) {
	    e.preventDefault();
	    return;
	  }

	  editor.setClipboard(getFragmentFromSelection(editor._latestEditorState));
	}

	editOnCopy_1 = editOnCopy;
	return editOnCopy_1;
}

export { requireEditOnCopy as __require };
//# sourceMappingURL=editOnCopy.js.map
