@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 == null) {
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 = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "4.7.0",
3
+ "version": "4.7.2",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"