mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-09-02 19:52:32 +02:00
Fix bug where last char of inline node couldn't be selected with keyboard (#626)
Fix bug where first char of inline node couldn't be selected with keyboard
This commit is contained in:
committed by
Ian Storm Taylor
parent
4f04d48cdc
commit
0cfd106a2d
@@ -491,11 +491,12 @@ function Plugin(options = {}) {
|
||||
const previousBlock = document.getClosestBlock(previous.key)
|
||||
const previousInline = document.getClosestInline(previous.key)
|
||||
|
||||
if (previousBlock == startBlock && previousInline && !previousInline.isVoid) {
|
||||
if (previousBlock === startBlock && previousInline && !previousInline.isVoid) {
|
||||
const extendOrMove = data.isShift ? 'extendBackward' : 'moveBackward'
|
||||
return state
|
||||
.transform()
|
||||
.collapseToEndOf(previous)
|
||||
.moveBackward(1)
|
||||
[extendOrMove](1)
|
||||
.apply()
|
||||
}
|
||||
|
||||
@@ -562,10 +563,11 @@ function Plugin(options = {}) {
|
||||
const nextInline = document.getClosestInline(next.key)
|
||||
|
||||
if (nextBlock == startBlock && nextInline) {
|
||||
const extendOrMove = data.isShift ? 'extendForward' : 'moveBackward'
|
||||
return state
|
||||
.transform()
|
||||
.collapseToStartOf(next)
|
||||
.moveForward(1)
|
||||
[extendOrMove](1)
|
||||
.apply()
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user