diff --git a/src/models/selection.js b/src/models/selection.js index 9c5b000b5..7e186318f 100644 --- a/src/models/selection.js +++ b/src/models/selection.js @@ -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 }) diff --git a/src/transforms/apply-operation.js b/src/transforms/apply-operation.js index ac578269c..ddef60ec7 100644 --- a/src/transforms/apply-operation.js +++ b/src/transforms/apply-operation.js @@ -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 }) diff --git a/test.js b/test.js index 159b27faa..4d46f3276 100644 --- a/test.js +++ b/test.js @@ -1,3 +1,5 @@ +/* eslint-disable no-console */ + import { Raw, Inline } from './src' function printNode(node, depth = 0) {