@flozy/editor 4.7.0 → 4.7.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,13 @@ import { Editor, Range, Text } from "slate";
|
|
2
2
|
const highlightSelection = ([node, path], editor = {}) => {
|
3
3
|
if (Text.isText(node) && editor?.selection) {
|
4
4
|
const intersection = Range.intersection(editor.selection, Editor.range(editor, path));
|
5
|
-
if (intersection
|
5
|
+
if (!intersection) {
|
6
|
+
return [];
|
7
|
+
}
|
8
|
+
|
9
|
+
// Avoid applying highlight if the range only includes line breaks
|
10
|
+
const rangeText = Editor.string(editor, intersection);
|
11
|
+
if (!rangeText.trim()) {
|
6
12
|
return [];
|
7
13
|
}
|
8
14
|
const range = {
|