1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-18 13:11:17 +02:00

Rename extend...Offset to move...Offset

This commit is contained in:
Soreine
2016-10-26 13:54:20 +02:00
parent e08ef88d54
commit 644b4b3cab
3 changed files with 6 additions and 4 deletions

View File

@@ -576,7 +576,7 @@ class Selection extends new Record(DEFAULTS) {
* @return {Selection} selection
*/
extendStartOffset(n = 1) {
moveStartOffset(n = 1) {
return this.isBackward
? this.merge({ focusOffset: this.focusOffset + n })
: this.merge({ anchorOffset: this.anchorOffset + n })
@@ -589,7 +589,7 @@ class Selection extends new Record(DEFAULTS) {
* @return {Selection} selection
*/
extendEndOffset(n = 1) {
moveEndOffset(n = 1) {
return this.isBackward
? this.merge({ anchorOffset: this.anchorOffset + n })
: this.merge({ focusOffset: this.focusOffset + n })

View File

@@ -116,10 +116,10 @@ function insertText(state, operation) {
// Update the selection
if (startKey == node.key && startOffset > offset) {
selection = selection.extendStartOffset(text.length)
selection = selection.moveStartOffset(text.length)
}
if (endKey == node.key && endOffset > offset) {
selection = selection.extendEndOffset(text.length)
selection = selection.moveEndOffset(text.length)
}
state = state.merge({ document, selection })

View File

@@ -1,3 +1,5 @@
/* eslint-disable no-console */
import { Raw, Inline } from './src'
function printNode(node, depth = 0) {