mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-03-05 13:39:04 +01:00
rebuild selection from anchorPath and focusPath if keys were dropped (#1980)
This commit is contained in:
parent
6e749e2f0e
commit
f83b3114db
@ -100,6 +100,18 @@ class Value extends Record(DEFAULTS) {
|
||||
let data = new Map()
|
||||
|
||||
document = Document.fromJSON(document)
|
||||
|
||||
// rebuild selection from anchorPath and focusPath if keys were dropped
|
||||
const { anchorPath, focusPath, anchorKey, focusKey } = selection
|
||||
|
||||
if (anchorPath !== undefined && anchorKey === undefined) {
|
||||
selection.anchorKey = document.assertPath(anchorPath).key
|
||||
}
|
||||
|
||||
if (focusPath !== undefined && focusKey === undefined) {
|
||||
selection.focusKey = document.assertPath(focusPath).key
|
||||
}
|
||||
|
||||
selection = Range.fromJSON(selection)
|
||||
schema = Schema.fromJSON(schema)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user