From 9a2b53e81c4f679c0aceebbc03bcf10ff6ef06be Mon Sep 17 00:00:00 2001 From: themithy <11431578+themithy@users.noreply.github.com> Date: Thu, 22 Aug 2019 04:39:58 +0200 Subject: [PATCH] Fix rendering of collapsed annotation at offset zero. (#2918) --- packages/slate/src/models/text.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/slate/src/models/text.js b/packages/slate/src/models/text.js index 7ffde0818..6eca9293e 100644 --- a/packages/slate/src/models/text.js +++ b/packages/slate/src/models/text.js @@ -194,7 +194,11 @@ class Text extends Record(DEFAULTS) { } // If the range starts after the leaf, or ends before it, continue. - if (start.offset > offset + length || end.offset <= offset) { + if ( + start.offset > offset + length || + end.offset < offset || + (end.offset === offset && offset !== 0) + ) { next.push(leaf) continue }