@flozy/editor 5.6.6 → 5.6.8

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 { getBreakpointLineSpacing, getTRBLBreakPoints } from "./helper/theme";
30
- import { getInitialValue, handleInsertLastElement, isFreeGrid, isFreeGridFragment, isPageSettings, outsideEditorClickLabel } from "./utils/helper";
30
+ import { getInitialValue, handleInsertLastElement, isFreeGrid, isFreeGridFragment, isRestrictedNode, 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";
@@ -391,8 +391,8 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
391
391
  } else if (event.key === "ArrowDown" && otherProps?.tagName !== "Pages") {
392
392
  upDownArrowKeyEvents(event, editor);
393
393
  } else if (event.key === "Backspace") {
394
- const isPageSettingsNode = isPageSettings(event, editor);
395
- if (isPageSettingsNode) {
394
+ const isNodeRestricted = isRestrictedNode(event, editor);
395
+ if (isNodeRestricted) {
396
396
  return;
397
397
  }
398
398
  const {
@@ -543,7 +543,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
543
543
  transition: "all 0.3s",
544
544
  minHeight: "87%",
545
545
  maxWidth: pageMaxWidth ? `${parseInt(pageMaxWidth)}px !important` : "auto",
546
- paddingTop: hasTopBanner() ? '20px !important' : ''
546
+ paddingTop: hasTopBanner() ? "20px !important" : ""
547
547
  },
548
548
  "data-info": outsideEditorClickLabel,
549
549
  children: [/*#__PURE__*/_jsx(Editable, {
@@ -1,4 +1,4 @@
1
- const VariableStyles = () => ({
1
+ const VariableStyles = theme => ({
2
2
  variablesItem: {
3
3
  color: "#2563EB",
4
4
  background: "#EEEEEE"
@@ -37,8 +37,26 @@ const VariableStyles = () => ({
37
37
  "& .MuiMenuItem-root": {
38
38
  color: "#64748B"
39
39
  },
40
+ "& .MuiPaper-root": {
41
+ borderRadius: '8px',
42
+ backgroundColor: `${theme?.palette?.editor?.miniToolBarBackground} !important`
43
+ },
44
+ "& .MuiList-root": {
45
+ padding: '0px'
46
+ },
47
+ "& .MuiButtonBase-root": {
48
+ margin: '6px',
49
+ borderRadius: '8px',
50
+ padding: '6px 14px',
51
+ fontSize: '14px',
52
+ fontWeight: '400',
53
+ color: theme?.palette?.editor?.deletePopUpButtonTextColor,
54
+ "&:hover": {
55
+ background: `${theme?.palette?.editor?.menuOptionHoverBackground} !important`
56
+ }
57
+ },
40
58
  "& .Mui-selected": {
41
- backgroundColor: "rgba(0, 0, 0, 0.04) !important"
59
+ backgroundColor: 'unset !important'
42
60
  }
43
61
  }
44
62
  });
@@ -3,11 +3,15 @@ import { useSlateStatic } from "slate-react";
3
3
  import { MenuItem, Select } from "@mui/material";
4
4
  import { insertVariables } from "../../utils/variables";
5
5
  import VariableStyles from "./Style";
6
- import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
6
+ import KeyboardArrowDownRoundedIcon from '@mui/icons-material/KeyboardArrowDownRounded';
7
+ import { useEditorContext } from "../../hooks/useMouseMove";
7
8
  import { jsx as _jsx } from "react/jsx-runtime";
8
9
  import { jsxs as _jsxs } from "react/jsx-runtime";
9
10
  const VariableButton = props => {
10
- const classes = VariableStyles();
11
+ const {
12
+ theme
13
+ } = useEditorContext();
14
+ const classes = VariableStyles(theme);
11
15
  const editor = useSlateStatic();
12
16
  const {
13
17
  options
@@ -24,7 +28,7 @@ const VariableButton = props => {
24
28
  value: "",
25
29
  sx: classes.variableBtn,
26
30
  onChange: updateVariable,
27
- IconComponent: () => /*#__PURE__*/_jsx(KeyboardArrowDownIcon, {}),
31
+ IconComponent: () => /*#__PURE__*/_jsx(KeyboardArrowDownRoundedIcon, {}),
28
32
  MenuProps: {
29
33
  sx: classes.variableMenuItem,
30
34
  PaperProps: {
@@ -49,6 +49,11 @@ const useCommonStyle = theme => ({
49
49
  fontWeight: "500",
50
50
  fontFamily: "Inter, sans-serif"
51
51
  },
52
+ "& .MuiPaper-root": {
53
+ border: `unset !important`,
54
+ borderRadius: '0px',
55
+ height: 'fit-content'
56
+ },
52
57
  "& p": {
53
58
  marginBottom: "7px",
54
59
  marginTop: "4px"
@@ -593,8 +593,9 @@ export const getPreviousNode = editor => {
593
593
  return;
594
594
  }
595
595
  };
596
- export const isPageSettings = (event, editor) => {
597
- let isPageSettingsNode = false;
596
+ const isRestricted = node => node?.type === "page-settings" || node?.type === "site-settings" || node?.children?.some(child => child.type === "dataView");
597
+ export const isRestrictedNode = (event, editor) => {
598
+ let isNodeRestricted = false;
598
599
  try {
599
600
  const {
600
601
  selection
@@ -607,21 +608,21 @@ export const isPageSettings = (event, editor) => {
607
608
  previousNode,
608
609
  previousPath
609
610
  } = getPreviousNode(editor) || {};
610
- if (previousNode?.type === "page-settings") {
611
+ if (isRestricted(previousNode)) {
611
612
  event.preventDefault(); // stops deleting backward
612
613
 
613
614
  // move the cursor to node which is before page-settings node
614
615
  const pathBeforePageSettings = Path.previous(previousPath);
615
616
  const endPath = Editor.end(editor, pathBeforePageSettings);
616
617
  Transforms.select(editor, endPath);
617
- isPageSettingsNode = true;
618
+ isNodeRestricted = true;
618
619
  }
619
620
  }
620
- return isPageSettingsNode;
621
+ return isNodeRestricted;
621
622
  } catch (err) {
622
623
  // if there is no previous node error throws, user reached the starting node and startting position
623
- isPageSettingsNode = true;
624
- return isPageSettingsNode;
624
+ isNodeRestricted = true;
625
+ return isNodeRestricted;
625
626
  }
626
627
  };
627
628
  export function capitalizeFirstLetter(str) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "5.6.6",
3
+ "version": "5.6.8",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"