mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-16 12:14:14 +02:00
fix: Path.previous()
dose not working when path is null
(#5029)
* fix: `Path.previous()` dose not working when path is `null` * feat: changeset add
This commit is contained in:
5
.changeset/nervous-cars-divide.md
Normal file
5
.changeset/nervous-cars-divide.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'slate': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: `Path.previous()` dose not working when path is `null`
|
@@ -451,16 +451,18 @@ export const TextTransforms: TextTransforms = {
|
|||||||
if (!options.at) {
|
if (!options.at) {
|
||||||
let path
|
let path
|
||||||
|
|
||||||
if (ends.length > 0) {
|
if (ends.length > 0 && endRef.current) {
|
||||||
path = Path.previous(endRef.current!)
|
path = Path.previous(endRef.current)
|
||||||
} else if (middles.length > 0) {
|
} else if (middles.length > 0 && middleRef.current) {
|
||||||
path = Path.previous(middleRef.current!)
|
path = Path.previous(middleRef.current)
|
||||||
} else {
|
} else if (startRef.current) {
|
||||||
path = Path.previous(startRef.current!)
|
path = Path.previous(startRef.current)
|
||||||
}
|
}
|
||||||
|
|
||||||
const end = Editor.end(editor, path)
|
if (path) {
|
||||||
Transforms.select(editor, end)
|
const end = Editor.end(editor, path)
|
||||||
|
Transforms.select(editor, end)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
startRef.unref()
|
startRef.unref()
|
||||||
|
Reference in New Issue
Block a user