@flozy/editor 5.5.8 → 5.5.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
|
|
1
|
-
import { Editor, Node, Path, Point,
|
2
|
-
import {
|
1
|
+
import { Editor, Node, Path, Point, Transforms } from "slate";
|
2
|
+
import { getNextNode } from "../utils/helper";
|
3
3
|
const BACKWARD_BLOCKS = ["list-item", "signature"];
|
4
4
|
const isNodeTextEmpty = node => {
|
5
5
|
const nodeText = Node.string(node);
|
@@ -30,37 +30,6 @@ const withCustomDeleteBackward = editor => {
|
|
30
30
|
return;
|
31
31
|
}
|
32
32
|
}
|
33
|
-
if (selection && Range.isCollapsed(selection)) {
|
34
|
-
const [currentNode, path] = Editor.node(editor, selection);
|
35
|
-
if (currentNode && typeof currentNode.text === 'string') {
|
36
|
-
const text = currentNode.text;
|
37
|
-
if (containsSurrogatePair(text)) {
|
38
|
-
// Check if the cursor is at the end of a surrogate pair
|
39
|
-
const {
|
40
|
-
offset
|
41
|
-
} = selection.anchor;
|
42
|
-
const beforeCursor = text.slice(0, offset);
|
43
|
-
const afterCursor = text.slice(offset);
|
44
|
-
if (containsSurrogatePair(beforeCursor) || containsSurrogatePair(afterCursor)) {
|
45
|
-
// Delete the entire surrogate pair
|
46
|
-
Transforms.delete(editor, {
|
47
|
-
at: {
|
48
|
-
anchor: {
|
49
|
-
path,
|
50
|
-
offset: offset - 2
|
51
|
-
},
|
52
|
-
// Move back 2 for surrogate pair
|
53
|
-
focus: {
|
54
|
-
path,
|
55
|
-
offset
|
56
|
-
}
|
57
|
-
}
|
58
|
-
});
|
59
|
-
return;
|
60
|
-
}
|
61
|
-
}
|
62
|
-
}
|
63
|
-
}
|
64
33
|
|
65
34
|
// Check if current node is a list item and is the last one, signature node
|
66
35
|
const [node] = Editor.nodes(editor, {
|