mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-03-06 22:09:47 +01: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:
parent
4f04d48cdc
commit
0cfd106a2d
@ -491,11 +491,12 @@ function Plugin(options = {}) {
|
|||||||
const previousBlock = document.getClosestBlock(previous.key)
|
const previousBlock = document.getClosestBlock(previous.key)
|
||||||
const previousInline = document.getClosestInline(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
|
return state
|
||||||
.transform()
|
.transform()
|
||||||
.collapseToEndOf(previous)
|
.collapseToEndOf(previous)
|
||||||
.moveBackward(1)
|
[extendOrMove](1)
|
||||||
.apply()
|
.apply()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -562,10 +563,11 @@ function Plugin(options = {}) {
|
|||||||
const nextInline = document.getClosestInline(next.key)
|
const nextInline = document.getClosestInline(next.key)
|
||||||
|
|
||||||
if (nextBlock == startBlock && nextInline) {
|
if (nextBlock == startBlock && nextInline) {
|
||||||
|
const extendOrMove = data.isShift ? 'extendForward' : 'moveBackward'
|
||||||
return state
|
return state
|
||||||
.transform()
|
.transform()
|
||||||
.collapseToStartOf(next)
|
.collapseToStartOf(next)
|
||||||
.moveForward(1)
|
[extendOrMove](1)
|
||||||
.apply()
|
.apply()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user