import { __require as requireEditorState } from './EditorState.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 keyCommandMoveSelectionToStartOfBlock_1;
var hasRequiredKeyCommandMoveSelectionToStartOfBlock;

function requireKeyCommandMoveSelectionToStartOfBlock () {
	if (hasRequiredKeyCommandMoveSelectionToStartOfBlock) return keyCommandMoveSelectionToStartOfBlock_1;
	hasRequiredKeyCommandMoveSelectionToStartOfBlock = 1;

	var EditorState = requireEditorState();
	/**
	 * Collapse selection at the start of the first selected block. This is used
	 * for Firefox versions that attempt to navigate forward/backward instead of
	 * moving the cursor. Other browsers are able to move the cursor natively.
	 */


	function keyCommandMoveSelectionToStartOfBlock(editorState) {
	  var selection = editorState.getSelection();
	  var startKey = selection.getStartKey();
	  return EditorState.set(editorState, {
	    selection: selection.merge({
	      anchorKey: startKey,
	      anchorOffset: 0,
	      focusKey: startKey,
	      focusOffset: 0,
	      isBackward: false
	    }),
	    forceSelection: true
	  });
	}

	keyCommandMoveSelectionToStartOfBlock_1 = keyCommandMoveSelectionToStartOfBlock;
	return keyCommandMoveSelectionToStartOfBlock_1;
}

export { requireKeyCommandMoveSelectionToStartOfBlock as __require };
//# sourceMappingURL=keyCommandMoveSelectionToStartOfBlock.js.map
