1
0
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:
Jinxuan Zhu
2018-02-21 15:36:34 -05:00
committed by Ian Storm Taylor
parent 324a025ee9
commit 1776d8e64c

View File

@@ -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()
} }