@flozy/editor 4.4.4 → 4.4.7
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.
|
@@ -27,7 +27,7 @@ import DragAndDrop from "./common/DnD";
|
|
|
27
27
|
import Section from "./common/Section";
|
|
28
28
|
import decorators from "./utils/Decorators";
|
|
29
29
|
import { getTRBLBreakPoints } from "./helper/theme";
|
|
30
|
-
import { handleInsertLastElement, isFreeGridFragment, outsideEditorClickLabel } from "./utils/helper";
|
|
30
|
+
import { getPreviousNode, handleInsertLastElement, isFreeGridFragment, outsideEditorClickLabel } from "./utils/helper";
|
|
31
31
|
import useWindowResize from "./hooks/useWindowResize";
|
|
32
32
|
import PopoverAIInput from "./Elements/AI/PopoverAIInput";
|
|
33
33
|
import RnDCopy from "./common/RnD/RnDCopy";
|
|
@@ -374,8 +374,12 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
374
374
|
if (!Range.isCollapsed(selection)) {
|
|
375
375
|
editor.deleteFragment();
|
|
376
376
|
} else {
|
|
377
|
+
const match = getPreviousNode(editor);
|
|
378
|
+
if (match?.type === "page-settings") {
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
377
381
|
editor.deleteBackward({
|
|
378
|
-
unit:
|
|
382
|
+
unit: "character"
|
|
379
383
|
});
|
|
380
384
|
}
|
|
381
385
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Editor, Node, Transforms, Element } from "slate";
|
|
1
|
+
import { Editor, Node, Transforms, Element, Path } from "slate";
|
|
2
2
|
import { ReactEditor } from "slate-react";
|
|
3
3
|
import insertNewLine from "./insertNewLine";
|
|
4
4
|
import { getDevice } from "../helper/theme";
|
|
@@ -470,4 +470,11 @@ export const editorThemeStyle = {
|
|
|
470
470
|
};
|
|
471
471
|
export const getEditorTheme = (themeType = "light") => {
|
|
472
472
|
return editorThemeStyle[themeType] || {};
|
|
473
|
+
};
|
|
474
|
+
export const getPreviousNode = editor => {
|
|
475
|
+
try {
|
|
476
|
+
const parentPath = Path.parent(editor?.selection?.anchor?.path);
|
|
477
|
+
const prevPath = Path.previous(parentPath);
|
|
478
|
+
return getNode(editor, prevPath);
|
|
479
|
+
} catch (err) {}
|
|
473
480
|
};
|