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 keyCommandMoveSelectionToEndOfBlock_1;
var hasRequiredKeyCommandMoveSelectionToEndOfBlock;

function requireKeyCommandMoveSelectionToEndOfBlock () {
	if (hasRequiredKeyCommandMoveSelectionToEndOfBlock) return keyCommandMoveSelectionToEndOfBlock_1;
	hasRequiredKeyCommandMoveSelectionToEndOfBlock = 1;

	var EditorState = requireEditorState();
	/**
	 * See comment for `moveSelectionToStartOfBlock`.
	 */


	function keyCommandMoveSelectionToEndOfBlock(editorState) {
	  var selection = editorState.getSelection();
	  var endKey = selection.getEndKey();
	  var content = editorState.getCurrentContent();
	  var textLength = content.getBlockForKey(endKey).getLength();
	  return EditorState.set(editorState, {
	    selection: selection.merge({
	      anchorKey: endKey,
	      anchorOffset: textLength,
	      focusKey: endKey,
	      focusOffset: textLength,
	      isBackward: false
	    }),
	    forceSelection: true
	  });
	}

	keyCommandMoveSelectionToEndOfBlock_1 = keyCommandMoveSelectionToEndOfBlock;
	return keyCommandMoveSelectionToEndOfBlock_1;
}

export { requireKeyCommandMoveSelectionToEndOfBlock as __require };
//# sourceMappingURL=keyCommandMoveSelectionToEndOfBlock.js.map
