1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-02-13 11:44:55 +01: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) {
const previous = this.getPreviousText(startKey)
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)
return char.marks.toArray()
}