@flozy/editor 9.5.0 → 9.5.2

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.
@@ -700,8 +700,8 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
700
700
  chars: chars,
701
701
  type: type,
702
702
  theme: theme,
703
- otherProps: otherProps,
704
- customProps: customProps
703
+ customProps: customProps,
704
+ otherProps: customProps
705
705
  }) : null, /*#__PURE__*/_jsx(RnDCopy, {
706
706
  readOnly: readOnly
707
707
  })]
@@ -83,3 +83,16 @@
83
83
  .slick-arrow.slick-hidden {
84
84
  display: none;
85
85
  }
86
+
87
+ .slick-dots li {
88
+ margin-top: 4px;
89
+ border: 0.5px solid #FFFFFF
90
+ }
91
+
92
+ .slick-dots .slick-active {
93
+ background-color: #2563EB !important;
94
+ }
95
+
96
+ .slick-dots li {
97
+ background-color: #9DA9BA;
98
+ }
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useRef } from "react";
1
+ import React, { useEffect, useRef, useState } from "react";
2
2
  import { Path, Transforms, Node } from "slate";
3
3
  import { ReactEditor, useSlateStatic } from "slate-react";
4
4
  import { Box, useTheme } from "@mui/material";
@@ -63,10 +63,9 @@ const FreeGrid = props => {
63
63
  height
64
64
  } = breakpointValues(element.type, breakpoint, element);
65
65
  const {
66
- setSelectedElement,
67
- setAutoAlign,
68
- autoAlign
66
+ setSelectedElement
69
67
  } = useEditorContext();
68
+ const [autoAlign, setAutoAlign] = useState(false);
70
69
  const count = useRef(2);
71
70
  const childrenCountRef = useRef(element?.children?.length);
72
71
  const onChange = data => {
@@ -563,6 +562,8 @@ const FreeGrid = props => {
563
562
  translation: translation,
564
563
  customProps: customProps,
565
564
  sectionElement: element,
565
+ autoAlign: autoAlign,
566
+ setAutoAlign: setAutoAlign,
566
567
  children: /*#__PURE__*/_jsxs(Box, {
567
568
  ...attributes,
568
569
  id: sectionName,
@@ -240,6 +240,9 @@ const useFreeGridStyles = ({
240
240
  fontSize: "14px",
241
241
  borderRadius: "7px"
242
242
  }
243
+ },
244
+ "& > .simple-text": {
245
+ display: "none"
243
246
  }
244
247
  },
245
248
  "& .fgi_type_form": {
@@ -25,6 +25,7 @@ const SearchButton = /*#__PURE__*/forwardRef((props, ref) => {
25
25
  const [target, setTarget] = useState(selectionTarget);
26
26
  const open = Boolean(anchorEl);
27
27
  const isMobile = window.matchMedia("(max-width: 899px)")?.matches || false;
28
+ const currentId = otherProps?.tagName === 'Brains' ? otherProps?.page_id : 0;
28
29
  const [mapData, setMapData] = useState([]);
29
30
  const [skip, setSkip] = useState(0);
30
31
  const [search, setSearch] = useState("");
@@ -65,7 +66,8 @@ const SearchButton = /*#__PURE__*/forwardRef((props, ref) => {
65
66
  getDocs({
66
67
  debouncedSearch,
67
68
  skip,
68
- limit
69
+ limit,
70
+ current_doc_id: currentId
69
71
  });
70
72
  }, [skip, debouncedSearch]);
71
73
  const getDocs = async () => {
@@ -75,7 +77,8 @@ const SearchButton = /*#__PURE__*/forwardRef((props, ref) => {
75
77
  const result = await otherProps?.services("getDocs", {
76
78
  skip,
77
79
  limit,
78
- search
80
+ search,
81
+ current_doc_id: currentId
79
82
  });
80
83
  setMapData(prev => skip === 0 ? result.data : [...prev, ...result.data]);
81
84
  }
@@ -78,6 +78,9 @@ const SearchAndDocList = ({
78
78
  InputProps: {
79
79
  startAdornment: /*#__PURE__*/_jsx(InputAdornment, {
80
80
  position: "start",
81
+ sx: {
82
+ pointerEvents: 'none'
83
+ },
81
84
  children: /*#__PURE__*/_jsx(SearchIcon, {})
82
85
  }),
83
86
  sx: {
@@ -18,8 +18,11 @@ const TextSize = ({
18
18
  const timerRef = useRef();
19
19
  const [size] = useWindowResize();
20
20
  const val = activeMark(editor, format);
21
- const noFontSize = val === "normal" || typeof val === "object" && !Object.keys(val)?.length;
22
- const value = noFontSize ? getTextSizeVal(editor) : getBreakPointsValue(val, size?.device);
21
+
22
+ // const noFontSize =
23
+ // val === "normal" || (typeof val === "object" && !Object.keys(val)?.length);
24
+
25
+ const value = getTextSizeVal(editor);
23
26
  useEffect(() => {
24
27
  setFontSize(getSizeVal());
25
28
  }, [value]);
@@ -39,9 +39,6 @@ const ColorPickerToolComponent = ({
39
39
  position: "relative"
40
40
  },
41
41
  children: [/*#__PURE__*/_jsx("div", {
42
- style: {
43
- marginBottom: "50px"
44
- },
45
42
  children: /*#__PURE__*/_jsx(CustomColorPicker, {
46
43
  gradient: hideGradient ? false : true,
47
44
  color: color,
@@ -53,14 +50,7 @@ const ColorPickerToolComponent = ({
53
50
  disableEditTheme: disableEditTheme
54
51
  })
55
52
  }), /*#__PURE__*/_jsxs("div", {
56
- style: {
57
- display: "flex",
58
- justifyContent: "end",
59
- margin: "8px",
60
- position: "absolute",
61
- bottom: 0,
62
- right: 0
63
- },
53
+ className: "colorPickerActionBtns",
64
54
  children: [/*#__PURE__*/_jsx(Button, {
65
55
  onClick: handleClose,
66
56
  className: "secondaryBtn",
@@ -4,6 +4,7 @@ import customColorPickerStyles from "./style";
4
4
  import { colors } from "../../Elements/Color Picker/defaultColors";
5
5
  import { useMemo, useState } from "react";
6
6
  import { useEditorContext } from "../../hooks/useMouseMove";
7
+ import { getVariableValue } from "../../helper/theme";
7
8
  import { jsx as _jsx } from "react/jsx-runtime";
8
9
  import { jsxs as _jsxs } from "react/jsx-runtime";
9
10
  const getColors = (colors, colorTab, key) => {
@@ -67,7 +68,7 @@ function CustomColorPicker(props) {
67
68
  sx: classes.customColorPickerContainer,
68
69
  children: [/*#__PURE__*/_jsx(ColorPickerTool, {
69
70
  gradient: gradient,
70
- value: color?.startsWith("var") ? "" : color,
71
+ value: color?.startsWith("var") ? getVariableValue(color) : color,
71
72
  onChange: onChange,
72
73
  defaultColors: [],
73
74
  popupWidth: "300",
@@ -69,7 +69,7 @@ const CMenus = {
69
69
  label: "Cut",
70
70
  render: translation => {
71
71
  return /*#__PURE__*/_jsxs(_Fragment, {
72
- children: [translation("Cut"), " ", /*#__PURE__*/_jsxs("span", {
72
+ children: [translation("Cut Section"), " ", /*#__PURE__*/_jsxs("span", {
73
73
  className: "shortcut-help-info",
74
74
  children: [/*#__PURE__*/_jsx(CMDIcon, {}), " X"]
75
75
  })]
@@ -80,7 +80,7 @@ const CMenus = {
80
80
  label: "Copy",
81
81
  render: translation => {
82
82
  return /*#__PURE__*/_jsxs(_Fragment, {
83
- children: [translation("Copy"), " ", /*#__PURE__*/_jsxs("span", {
83
+ children: [translation("Copy Section"), " ", /*#__PURE__*/_jsxs("span", {
84
84
  className: "shortcut-help-info",
85
85
  children: [/*#__PURE__*/_jsx(CMDIcon, {}), " C"]
86
86
  })]
@@ -91,15 +91,12 @@ const CMenus = {
91
91
  label: "Paste",
92
92
  render: translation => {
93
93
  return /*#__PURE__*/_jsxs(_Fragment, {
94
- children: [translation("Paste"), " ", /*#__PURE__*/_jsxs("span", {
94
+ children: [translation("Paste Section"), " ", /*#__PURE__*/_jsxs("span", {
95
95
  className: "shortcut-help-info",
96
96
  children: [/*#__PURE__*/_jsx(CMDIcon, {}), " V"]
97
97
  })]
98
98
  });
99
99
  }
100
- }, {
101
- name: "delete",
102
- label: "Delete"
103
100
  }],
104
101
  "parent-container": [{
105
102
  name: "cut",
@@ -70,7 +70,7 @@ const handleMoveNode = (editor, path, newPath, {
70
70
  export const reRenderChildNodes = (editor, path) => {
71
71
  try {
72
72
  const sectionNode = Node.get(editor, path);
73
- console.log("sectionNode", sectionNode);
73
+
74
74
  // parent node
75
75
  Transforms.setNodes(editor, {
76
76
  updated_at: new Date().getTime()
@@ -103,9 +103,7 @@ function isContainerElement(editor, moveTopath, props, appenBp) {
103
103
  // get parent node
104
104
  parentNode = Node.get(editor, Path.parent(dragItemPath));
105
105
  }
106
- console.log("moveTopath", moveTopath, path, parentPath, dragOver);
107
106
  const moveToNode = Node.get(editor, moveTopath);
108
- console.log("parentNode, moveToNode", parentNode, moveToNode);
109
107
  const leftOfMoveToNode = moveToNode[`left${appenBp}`];
110
108
  if (moveToNode.type === "freegridBox") {
111
109
  if (parentNode.type === "freegridBox") {
@@ -216,7 +214,7 @@ export function onDropItem(props, parentClass) {
216
214
 
217
215
  // const boxNode = Node.get(editor, moveTo);
218
216
 
219
- if (moveSectionToSection && autoAlign) {
217
+ if (moveTo?.length === 2 && autoAlign) {
220
218
  // auto align in mobile
221
219
  Transforms.setNodes(editor, {
222
220
  xs_updatedOn: null
@@ -41,7 +41,7 @@ const getBoxToAutoAlign = (editor, sectionPath) => {
41
41
  at: sectionPath,
42
42
  match: node => node.type === "freegridBox" && node.autoAlign
43
43
  });
44
- return boxData;
44
+ return boxData || [];
45
45
  };
46
46
  const handleGridItems = (gridItems, lastRow) => {
47
47
  // to find the previously occupied rows
@@ -242,6 +242,9 @@ export const handleBoxAlignment = (editor, sectionNode, sectionPath) => {
242
242
  }, {
243
243
  at: boxPath
244
244
  });
245
+ if (!boxNode) {
246
+ return;
247
+ }
245
248
  const containerItems = boxNode?.children || [];
246
249
  const {
247
250
  containerHeight
@@ -9,6 +9,15 @@ const useVirtualElementStyles = () => ({
9
9
  opacity: 1,
10
10
  right: 0,
11
11
  top: 0,
12
+ "& .leaf-item": {
13
+ fontSize: "var(--fontSize_xs) !important",
14
+ "& span": {
15
+ fontSize: "var(--fontSize_xs) !important"
16
+ }
17
+ },
18
+ "& .editor-blocker": {
19
+ display: "none"
20
+ },
12
21
  "& .freegrid-item": {
13
22
  position: "relative !important",
14
23
  top: "0 !important",
@@ -18,6 +27,9 @@ const useVirtualElementStyles = () => ({
18
27
  left: "24px !important",
19
28
  marginTop: "var(--marginTop_xs) !important",
20
29
  outline: "1px solid gray !important",
30
+ "&.type_text": {
31
+ height: "auto !important"
32
+ },
21
33
  // "&.type_box": {
22
34
  // // display: "grid !important",
23
35
  // // gridTemplateRows: "repeat(auto-fill, 50px) !important",
@@ -44,6 +56,15 @@ export const useAutoAlignStyles = () => ({
44
56
  top: 0,
45
57
  height: "auto !important",
46
58
  pointerEvents: "none",
59
+ "& .leaf-item": {
60
+ fontSize: "var(--fontSize_xs) !important",
61
+ "& span": {
62
+ fontSize: "var(--fontSize_xs) !important"
63
+ }
64
+ },
65
+ "& .editor-blocker": {
66
+ display: "none"
67
+ },
47
68
  "& .freegrid-item": {
48
69
  position: "relative !important",
49
70
  top: "0 !important",
@@ -61,6 +82,9 @@ export const useAutoAlignStyles = () => ({
61
82
  width: "var(--width_xs) !important",
62
83
  height: "var(--height_xs) !important"
63
84
  },
85
+ "&.type_text": {
86
+ height: "auto !important"
87
+ },
64
88
  // start - default signature classes on free-grid
65
89
  "& .fgi_type_signature": {
66
90
  height: "100%",
@@ -71,7 +71,9 @@ const RnD = props => {
71
71
  itemData = {},
72
72
  customProps,
73
73
  sectionElement,
74
- dataSets
74
+ dataSets,
75
+ autoAlign,
76
+ setAutoAlign
75
77
  } = props;
76
78
  const {
77
79
  isSelectedElement,
@@ -79,9 +81,7 @@ const RnD = props => {
79
81
  updateDragging,
80
82
  contextMenu,
81
83
  setContextMenu,
82
- theme,
83
- autoAlign,
84
- setAutoAlign
84
+ theme
85
85
  } = useEditorContext();
86
86
  const str_path = path.join("|");
87
87
  const selectedElementProps = isSelectedElement(str_path, type);
@@ -2,7 +2,8 @@ import React, { useEffect, useMemo, useState } from "react";
2
2
  import { Grid, TextField, InputAdornment, Typography, Tooltip } from "@mui/material";
3
3
  import ColorPickerButton from "../../ColorPickerButton";
4
4
  import { useSlateStatic } from "slate-react";
5
- import { getElementStyle, getVariableValue } from "../../../helper/theme";
5
+ import { getVariableValue } from "../../../helper/theme";
6
+ import { useButtonStyle } from "../../../hooks/useThemeValues";
6
7
  import { jsx as _jsx } from "react/jsx-runtime";
7
8
  import { jsxs as _jsxs } from "react/jsx-runtime";
8
9
  const MAP_STYLE_PROPS = {
@@ -29,18 +30,21 @@ const Color = props => {
29
30
  } = customProps;
30
31
  const [recentColors, setRecentColors] = useState({});
31
32
  const editor = useSlateStatic();
33
+ const {
34
+ buttonStyle
35
+ } = useButtonStyle(val, editor, elementProps, MAP_STYLE_PROPS[key]);
32
36
  const {
33
37
  value,
34
38
  inputValue
35
39
  } = useMemo(() => {
36
40
  const isVariable = val && val.startsWith("var");
37
- const value = isVariable ? val : getElementStyle(editor, elementProps, MAP_STYLE_PROPS[key]);
38
- const inputValue = isVariable ? getVariableValue(val) : getElementStyle(editor, elementProps, MAP_STYLE_PROPS[key]);
41
+ const value = isVariable ? val : buttonStyle;
42
+ const inputValue = isVariable ? getVariableValue(val) : buttonStyle;
39
43
  return {
40
44
  value: value || val,
41
45
  inputValue: inputValue || val
42
46
  };
43
- }, [editor, val]);
47
+ }, [buttonStyle, val]);
44
48
  const getLable = label === "Text" ? translation("selectTextColor") : label === "Background" ? translation("selectBgColor") : translation(label);
45
49
  useEffect(() => {
46
50
  const storedColors = JSON.parse(localStorage.getItem("recentColors"));
@@ -136,6 +136,9 @@ const useCommonStyle = theme => ({
136
136
  width: "46px !important",
137
137
  marginLeft: "10px",
138
138
  height: "36px !important"
139
+ },
140
+ "& .spacingSlider": {
141
+ width: "calc(100% - 18px)"
139
142
  }
140
143
  },
141
144
  "& .MuiFormHelperText-root": {
@@ -247,6 +250,16 @@ const useCommonStyle = theme => ({
247
250
  backgroundColor: theme?.palette?.editor?.miniToolBarBackground,
248
251
  color: theme?.palette?.editor?.textColor
249
252
  }
253
+ },
254
+ "& .colorPickerActionBtns": {
255
+ backgroundColor: theme?.palette?.editor?.background,
256
+ display: "flex",
257
+ justifyContent: "end",
258
+ padding: "10px",
259
+ position: "sticky",
260
+ bottom: 0,
261
+ right: 0,
262
+ boxShadow: "0px -3px 12px 0px #00000017"
250
263
  }
251
264
  },
252
265
  colorPickerBtnBorder: {
@@ -40,7 +40,6 @@ export const EditorProvider = ({
40
40
  });
41
41
  const [fontFamilies, setFontFamilies] = useState(defaultFontFamilies);
42
42
  const [activeBreakPoint, setActiveBreakPoint] = useState("");
43
- const [autoAlign, setAutoAlign] = useState(false);
44
43
  useEffect(() => {
45
44
  window.updateSelectedItem = d => {
46
45
  setSelectedElement(d);
@@ -108,10 +107,8 @@ export const EditorProvider = ({
108
107
  setOpenTheme,
109
108
  activeBreakPoint,
110
109
  setActiveBreakPoint,
111
- triggerRender,
112
- autoAlign,
113
- setAutoAlign
114
- }), [path, editor?.selection, selectedPath, selectedElement, contextMenu, openAI, popupType, drop, openTheme, activeBreakPoint, autoAlign]);
110
+ triggerRender
111
+ }), [path, editor?.selection, selectedPath, selectedElement, contextMenu, openAI, popupType, drop, openTheme, activeBreakPoint]);
115
112
  return /*#__PURE__*/_jsx(EditorContext.Provider, {
116
113
  value: otherValues,
117
114
  children: children
@@ -0,0 +1,31 @@
1
+ import { useEffect, useState } from "react";
2
+ import { getElementProperty } from "../helper/theme";
3
+ import { ReactEditor } from "slate-react";
4
+ import { Node } from "slate";
5
+ function useThemeValues() {
6
+ return {};
7
+ }
8
+ export default useThemeValues;
9
+ export function useButtonStyle(value, editor, element, stylePropertyName) {
10
+ const [buttonStyle, setButtonStyle] = useState(value);
11
+ useEffect(() => {
12
+ const style = getButtonElementStyle(editor, element, stylePropertyName);
13
+ setButtonStyle(style);
14
+ }, [value, editor, element, stylePropertyName]);
15
+ return {
16
+ buttonStyle
17
+ };
18
+ }
19
+ export function getButtonElementStyle(editor, element, stylePropertyName) {
20
+ try {
21
+ const path = ReactEditor.findPath(editor, element);
22
+ if (path?.length) {
23
+ const currentEle = Node.get(editor, path);
24
+ const dom = ReactEditor.toDOMNode(editor, currentEle);
25
+ const editorBtn = dom?.querySelector(".button.theme-element");
26
+ return getElementProperty(editorBtn, stylePropertyName);
27
+ }
28
+ } catch (err) {
29
+ // console.log(err);
30
+ }
31
+ }
@@ -1,3 +1,4 @@
1
+ import { getDevice } from "../helper/theme";
1
2
  const themeClassName = ".theme-element";
2
3
  function getTextStyles(props) {
3
4
  const {
@@ -5,11 +6,13 @@ function getTextStyles(props) {
5
6
  textDecoration,
6
7
  ...rest
7
8
  } = props;
9
+ const device = getDevice();
10
+ const fontS = typeof fontSize === "object" ? fontSize[device] : fontSize;
8
11
  return {
9
12
  ...rest,
10
13
  '& span[data-slate-string="true"]': {
11
14
  textDecoration,
12
- fontSize
15
+ fontSize: fontS
13
16
  }
14
17
 
15
18
  // "&::after": {
@@ -112,14 +112,15 @@ const ColorTheme = props => {
112
112
  onColorChange(selectedColor, i);
113
113
  }
114
114
  },
115
- hideThemeColors: true,
116
- hideGradient: true,
115
+ hideThemeColors: true
116
+ // hideGradient={true}
117
+ ,
117
118
  classes: classes,
118
119
  value: color,
119
120
  children: /*#__PURE__*/_jsxs(Grid, {
120
121
  className: "pmBox",
121
122
  style: {
122
- backgroundColor: color
123
+ background: color
123
124
  },
124
125
  children: [/*#__PURE__*/_jsx(IconButton, {
125
126
  className: "editBtn",
@@ -163,14 +164,15 @@ const ColorTheme = props => {
163
164
  onColorChange(selectedColor, colorIndex);
164
165
  }
165
166
  },
166
- hideThemeColors: true,
167
- hideGradient: true,
167
+ hideThemeColors: true
168
+ // hideGradient={true}
169
+ ,
168
170
  classes: classes,
169
171
  value: color,
170
172
  children: /*#__PURE__*/_jsxs(Grid, {
171
173
  className: "sdBox",
172
174
  style: {
173
- backgroundColor: color
175
+ background: color
174
176
  },
175
177
  children: [/*#__PURE__*/_jsx(IconButton, {
176
178
  className: "editBtn",
@@ -29,8 +29,8 @@ const Style = ({
29
29
  fontSize: "12px",
30
30
  color: "#64748B",
31
31
  ".dotColor": {
32
- width: "12px",
33
- height: "12px",
32
+ width: "14px",
33
+ height: "14px",
34
34
  borderRadius: "12px",
35
35
  background: "#0F172A",
36
36
  marginRight: "3px"
@@ -40,7 +40,8 @@ const Style = ({
40
40
  width: "200px",
41
41
  whiteSpace: "nowrap",
42
42
  overflow: "hidden",
43
- textOverflow: "ellipsis"
43
+ textOverflow: "ellipsis",
44
+ color: `${appTheme?.palette?.editor?.textColor} !important`
44
45
  },
45
46
  ".MuiAutocomplete-input": {
46
47
  color: appTheme?.palette?.editor?.textColor
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "9.5.0",
3
+ "version": "9.5.2",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"