1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | 'use strict';
|
12 |
|
13 | var EditorState = require("./EditorState");
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 | function keyCommandMoveSelectionToEndOfBlock(editorState) {
|
20 | var selection = editorState.getSelection();
|
21 | var endKey = selection.getEndKey();
|
22 | var content = editorState.getCurrentContent();
|
23 | var textLength = content.getBlockForKey(endKey).getLength();
|
24 | return EditorState.set(editorState, {
|
25 | selection: selection.merge({
|
26 | anchorKey: endKey,
|
27 | anchorOffset: textLength,
|
28 | focusKey: endKey,
|
29 | focusOffset: textLength,
|
30 | isBackward: false
|
31 | }),
|
32 | forceSelection: true
|
33 | });
|
34 | }
|
35 |
|
36 | module.exports = keyCommandMoveSelectionToEndOfBlock; |
\ | No newline at end of file |