@flozy/editor 4.5.3 → 4.5.6
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.
|
@@ -114,7 +114,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
114
114
|
editorClass,
|
|
115
115
|
fixedWidth = "60%",
|
|
116
116
|
fullWidth = "80%",
|
|
117
|
-
hideTools
|
|
117
|
+
hideTools = []
|
|
118
118
|
} = otherProps || {};
|
|
119
119
|
const editor = useMemo(() => {
|
|
120
120
|
if (collaborativeEditor) return collaborativeEditor;
|
|
@@ -365,10 +365,24 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
365
365
|
});
|
|
366
366
|
} else if (event.key === "Enter") {
|
|
367
367
|
enterEvent(event, editor, customProps?.isMobile);
|
|
368
|
-
} else if (event.key === "ArrowUp" && otherProps?.tagName !==
|
|
368
|
+
} else if (event.key === "ArrowUp" && otherProps?.tagName !== "Pages") {
|
|
369
369
|
upDownArrowKeyEvents(event, editor);
|
|
370
|
-
} else if (event.key === "ArrowDown" && otherProps?.tagName !==
|
|
370
|
+
} else if (event.key === "ArrowDown" && otherProps?.tagName !== "Pages") {
|
|
371
371
|
upDownArrowKeyEvents(event, editor);
|
|
372
|
+
} else if (event.key === "Backspace") {
|
|
373
|
+
const {
|
|
374
|
+
selection
|
|
375
|
+
} = editor;
|
|
376
|
+
event.preventDefault();
|
|
377
|
+
if (selection) {
|
|
378
|
+
if (!Range.isCollapsed(selection)) {
|
|
379
|
+
editor.deleteFragment();
|
|
380
|
+
} else {
|
|
381
|
+
editor.deleteBackward({
|
|
382
|
+
unit: "character"
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
}
|
|
372
386
|
}
|
|
373
387
|
}, [chars, target, mentions, setMentions, search, type, mentionsRef]);
|
|
374
388
|
const Overlay = collaborativeEditor && !isReadOnly ? RemoteCursorOverlay : React.Fragment;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Editor, Range, Text } from "slate";
|
|
2
|
-
const highlightSelection = ([node, path], editor) => {
|
|
3
|
-
if (Text.isText(node) && editor
|
|
2
|
+
const highlightSelection = ([node, path], editor = {}) => {
|
|
3
|
+
if (Text.isText(node) && editor?.selection) {
|
|
4
4
|
const intersection = Range.intersection(editor.selection, Editor.range(editor, path));
|
|
5
5
|
if (intersection == null) {
|
|
6
6
|
return [];
|