mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-20 06:01:24 +02:00
Fixing the bug that getMarks steals mark from the previous block (#1645)
This commit is contained in:
committed by
Ian Storm Taylor
parent
324a025ee9
commit
1776d8e64c
@@ -1130,6 +1130,11 @@ class Node {
|
|||||||
if (startOffset == 0) {
|
if (startOffset == 0) {
|
||||||
const previous = this.getPreviousText(startKey)
|
const previous = this.getPreviousText(startKey)
|
||||||
if (!previous || previous.text.length == 0) return []
|
if (!previous || previous.text.length == 0) return []
|
||||||
|
if (
|
||||||
|
this.getClosestBlock(startKey) !== this.getClosestBlock(previous.key)
|
||||||
|
) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
const char = previous.characters.get(previous.text.length - 1)
|
const char = previous.characters.get(previous.text.length - 1)
|
||||||
return char.marks.toArray()
|
return char.marks.toArray()
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user