From 105b384ccb2aebcfd0e53add50400f79af72ac56 Mon Sep 17 00:00:00 2001 From: Justin Weiss Date: Sat, 2 Dec 2017 12:35:16 -0800 Subject: [PATCH] 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. --- packages/slate/src/models/node.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/slate/src/models/node.js b/packages/slate/src/models/node.js index 49d9c357f..b24e4a9cd 100644 --- a/packages/slate/src/models/node.js +++ b/packages/slate/src/models/node.js @@ -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() }