1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-02-13 11:44:55 +01:00

Fix activeMarks at the beginning of a line (#1434)

If you move to the beginning of a text node, and the previous text
node has marks, `marks` is set but `activeMarks` is not. This was
caused by `getActiveMarksAtRangeAsArray` looking for a function that
didn't exist. With this change, `activeMarks` is brought in line with
how `marks` works for collapsed selections.
This commit is contained in:
Justin Weiss 2017-12-02 12:35:16 -08:00 committed by Ian Storm Taylor
parent 7032339ca2
commit 105b384ccb

View File

@ -1082,8 +1082,8 @@ class Node {
// If the range is collapsed at the start of the node, check the previous.
if (range.isCollapsed && startOffset == 0) {
const previous = this.getPreviousText(startKey)
if (!previous || !previous.length) return []
const char = previous.characters.get(previous.length - 1)
if (!previous || previous.text.length == 0) return []
const char = previous.characters.get(previous.text.length - 1)
return char.marks.toArray()
}