custom-app
Version:
ITIMS��Ʒ�鿪��ר��React���,�Dz��ý��ּ�dhcc-app���������
38 lines (34 loc) • 1.09 kB
Flow
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule keyCommandMoveSelectionToEndOfBlock
* @format
* @flow
*/
;
var EditorState = require('./EditorState');
/**
* See comment for `moveSelectionToStartOfBlock`.
*/
function keyCommandMoveSelectionToEndOfBlock(editorState: EditorState): 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
});
}
module.exports = keyCommandMoveSelectionToEndOfBlock;