mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-29 01:50:06 +02: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:
committed by
Ian Storm Taylor
parent
7032339ca2
commit
105b384ccb
@@ -1082,8 +1082,8 @@ class Node {
|
|||||||
// If the range is collapsed at the start of the node, check the previous.
|
// If the range is collapsed at the start of the node, check the previous.
|
||||||
if (range.isCollapsed && startOffset == 0) {
|
if (range.isCollapsed && startOffset == 0) {
|
||||||
const previous = this.getPreviousText(startKey)
|
const previous = this.getPreviousText(startKey)
|
||||||
if (!previous || !previous.length) return []
|
if (!previous || previous.text.length == 0) return []
|
||||||
const char = previous.characters.get(previous.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