@flozy/editor 4.5.4 → 4.5.6
Sign up to get free protection for your applications and to get access to all the features.
@@ -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;
|
@@ -215,7 +215,7 @@ const editorStyles = ({
|
|
215
215
|
},
|
216
216
|
"& .content-editable.empty": {
|
217
217
|
"&:after": {
|
218
|
-
color: theme
|
218
|
+
color: theme?.palette?.type === "dark" ? "#99A5B6" : placeHolderColor
|
219
219
|
}
|
220
220
|
},
|
221
221
|
"& .checkbox-edit": {
|
@@ -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 [];
|