@flozy/editor 4.4.6 → 4.4.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -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: 'character'
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
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "4.4.6",
3
+ "version": "4.4.8",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"