mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-18 13:11:17 +02:00
Be inclusive for selection in insertText
This commit is contained in:
@@ -115,10 +115,10 @@ function insertText(state, operation) {
|
||||
document = document.updateDescendant(node)
|
||||
|
||||
// Update the selection
|
||||
if (startKey == node.key && startOffset > offset) {
|
||||
if (startKey == node.key && startOffset >= offset) {
|
||||
selection = selection.moveStartOffset(text.length)
|
||||
}
|
||||
if (endKey == node.key && endOffset > offset) {
|
||||
if (endKey == node.key && endOffset >= offset) {
|
||||
selection = selection.moveEndOffset(text.length)
|
||||
}
|
||||
|
||||
|
@@ -21,7 +21,9 @@ export default function (state) {
|
||||
|
||||
assert.deepEqual(
|
||||
next.selection.toJS(),
|
||||
nextSelection.toJS()
|
||||
nextSelection.merge({
|
||||
focusOffset: 6
|
||||
}).toJS()
|
||||
)
|
||||
|
||||
return next
|
||||
|
@@ -22,6 +22,7 @@ export default function (state) {
|
||||
assert.deepEqual(
|
||||
next.selection.toJS(),
|
||||
nextSelection.merge({
|
||||
anchorOffset: 4,
|
||||
focusOffset: 6
|
||||
}).toJS()
|
||||
)
|
||||
|
Reference in New Issue
Block a user