@flozy/editor 9.3.9 → 9.4.0

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.
@@ -141,7 +141,10 @@ const MultiSelectWithPopover = props => {
141
141
  onClick: handleOpenPopover,
142
142
  children: selectedOptions?.map((option, index) => /*#__PURE__*/_jsx(Chip, {
143
143
  label: option?.value,
144
- onDelete: () => setSelectedOptions(prev => prev.filter(selected => selected?.value !== option?.value)),
144
+ onDelete: event => {
145
+ event.stopPropagation();
146
+ setSelectedOptions(prev => prev.filter(selected => selected?.value !== option?.value));
147
+ },
145
148
  deleteIcon: /*#__PURE__*/_jsx(CloseIcon, {}),
146
149
  variant: "filled",
147
150
  sx: {
@@ -162,6 +165,7 @@ const MultiSelectWithPopover = props => {
162
165
  id: id,
163
166
  open: open,
164
167
  anchorEl: anchorEl,
168
+ anchor: "bottom",
165
169
  onClose: handleClosePopover,
166
170
  anchorOrigin: {
167
171
  vertical: "top",
@@ -181,7 +185,7 @@ const MultiSelectWithPopover = props => {
181
185
  },
182
186
  children: /*#__PURE__*/_jsxs(Box, {
183
187
  sx: {
184
- width: 300
188
+ width: isMobile ? "100%" : 300
185
189
  },
186
190
  children: [/*#__PURE__*/_jsx(Autocomplete, {
187
191
  multiple: true,
@@ -195,7 +199,7 @@ const MultiSelectWithPopover = props => {
195
199
  overflowX: "hidden",
196
200
  pr: '12px',
197
201
  pl: '12px',
198
- maxWidth: "275px",
202
+ maxWidth: isMobile ? "100%" : "275px",
199
203
  marginTop: '12px',
200
204
  ...customScrollStyles
201
205
  }
@@ -205,13 +209,10 @@ const MultiSelectWithPopover = props => {
205
209
  getOptionLabel: option => options?.value || "",
206
210
  value: selectedOptions,
207
211
  onChange: (event, newValues) => {
208
- // Filter and map the new values properly
209
212
  const addedOptions = newValues?.filter(value => typeof value === "object" || typeof value === "string" && value?.trim() !== "")?.map(value => typeof value === "string" ? {
210
213
  value,
211
214
  color: chipColor
212
215
  } : value);
213
-
214
- // Check if any new value already exists in selectedOptions
215
216
  const isDuplicate = addedOptions?.some(newOpt => (selectedOptions || [])?.some(opt => opt.value === newOpt.value));
216
217
  if (!isDuplicate) {
217
218
  setSelectedOptions([...selectedOptions, ...addedOptions]);
@@ -282,14 +283,14 @@ const MultiSelectWithPopover = props => {
282
283
  ...getTagProps({
283
284
  index
284
285
  }),
286
+ onDelete: event => {
287
+ event.stopPropagation();
288
+ setSelectedOptions(prev => prev.filter(selected => selected?.value !== option?.value));
289
+ },
285
290
  deleteIcon: /*#__PURE__*/_jsx(CloseIcon, {}),
286
291
  sx: {
287
292
  backgroundColor: option?.color,
288
293
  color: '#0F172A',
289
- // maxWidth: 200,
290
- // overflow: "hidden",
291
- // textOverflow: "ellipsis",
292
- // whiteSpace: "nowrap",
293
294
  "& .MuiChip-deleteIcon": {
294
295
  flexShrink: 0,
295
296
  "& path": {
@@ -104,7 +104,8 @@ function ForceAutoAlignment(props) {
104
104
  "aria-hidden": "true",
105
105
  dangerouslySetInnerHTML: {
106
106
  __html: getItems()
107
- }
107
+ },
108
+ contentEditable: false
108
109
  });
109
110
  }
110
111
  export default ForceAutoAlignment;
@@ -3,6 +3,7 @@ import { Path, Transforms } from "slate";
3
3
  import { getNode } from "../../../utils/helper";
4
4
  import { ROW_HEIGHT } from "../Utils/gridDropItem";
5
5
  import { findFirstRowOverlap, getGridArea, handleContainers, moveOverlappedItems } from "./helper";
6
+ import { Box } from "@mui/material";
6
7
  import { jsx as _jsx } from "react/jsx-runtime";
7
8
  const updateTextHeight = (editor, path, height) => {
8
9
  if (!height) {
@@ -72,15 +73,21 @@ function VirtualTextElement(props) {
72
73
  path,
73
74
  editor
74
75
  } = props;
75
- const textRef = useRef(null);
76
76
  const currElement = getCurrentEle();
77
+ const textRef = useRef(null);
78
+ const prevTextRef = useRef(currElement?.innerText);
77
79
  useEffect(() => {
78
80
  const observer = new ResizeObserver(([entry]) => {
79
81
  if (entry) {
80
82
  const {
81
83
  height
82
84
  } = entry.contentRect;
83
- updateTextHeight(editor, path, height);
85
+ const currentText = currElement?.innerText;
86
+ const prevText = prevTextRef.current;
87
+ if (currentText && currentText !== prevText) {
88
+ updateTextHeight(editor, path, height);
89
+ }
90
+ prevTextRef.current = currentText;
84
91
  }
85
92
  });
86
93
  const elementRef = textRef?.current;
@@ -94,19 +101,34 @@ function VirtualTextElement(props) {
94
101
  }
95
102
  observer.disconnect();
96
103
  };
97
- }, []);
98
- return /*#__PURE__*/_jsx("div", {
104
+ }, [currElement?.innerText]);
105
+ return /*#__PURE__*/_jsx(Box, {
99
106
  style: {
100
107
  position: "fixed",
101
108
  width: dataSets["data-width-xs"],
102
109
  minHeight: "fit-content",
103
110
  visibility: "hidden",
104
111
  pointerEvents: "none",
105
- right: 0,
106
- top: 0
112
+ right: 100,
113
+ top: 100
107
114
  },
108
115
  ref: textRef,
109
- children: currElement?.innerText
116
+ sx: {
117
+ "& .leaf-item": {
118
+ fontSize: "var(--fontSize_xs) !important",
119
+ "& span": {
120
+ fontSize: "var(--fontSize_xs) !important"
121
+ }
122
+ },
123
+ "& .editor-blocker": {
124
+ display: "none"
125
+ }
126
+ },
127
+ dangerouslySetInnerHTML: {
128
+ __html: currElement?.innerHTML
129
+ },
130
+ contentEditable: false,
131
+ id: "virtual-text-element"
110
132
  });
111
133
  }
112
134
  export default VirtualTextElement;
@@ -228,7 +228,8 @@ const VirtualElement = props => {
228
228
  // gridTemplateRows: `repeat(${lastRow - 1}, ${ROW_HEIGHT}px)`,
229
229
  ...classes.root
230
230
  },
231
- "aria-hidden": "true"
231
+ "aria-hidden": "true",
232
+ contentEditable: false
232
233
  });
233
234
  };
234
235
  export default VirtualElement;
@@ -5,7 +5,7 @@ const useVirtualElementStyles = () => ({
5
5
  // backgroundColor: "red",
6
6
  // height: "fit-content",
7
7
  overflow: "visible",
8
- // pointerEvents: "none",
8
+ pointerEvents: "none",
9
9
  opacity: 1,
10
10
  right: 0,
11
11
  top: 0,
@@ -44,6 +44,7 @@ export const useAutoAlignStyles = () => ({
44
44
  top: 0,
45
45
  height: "auto !important",
46
46
  zIndex: 99999999,
47
+ pointerEvents: "none",
47
48
  "& .freegrid-item": {
48
49
  position: "relative !important",
49
50
  top: "0 !important",
@@ -662,7 +662,7 @@ const RnD = props => {
662
662
  sectionElement: sectionElement,
663
663
  sectionCls: `.freegrid-section_${path.join("_")}`,
664
664
  dataSets: dataSets
665
- }) : null, childType === "text" && breakpoint === "lg" && !readOnly ? /*#__PURE__*/_jsx(VirtualTextElement, {
665
+ }) : null, childType === "text" && breakpoint === "lg" && !readOnly && enable ? /*#__PURE__*/_jsx(VirtualTextElement, {
666
666
  editor: editor,
667
667
  dataSets: dataSets,
668
668
  getCurrentEle: getCurrentEle,
@@ -338,7 +338,7 @@ export const getMarked = (leaf, children, theme) => {
338
338
  const fontSizeWithBreakpoints = wrapThemeBreakpoints(fontSizesImportant, "fontSize", theme);
339
339
  children = /*#__PURE__*/_jsx("span", {
340
340
  children: /*#__PURE__*/_jsx(Box, {
341
- className: className,
341
+ className: `${className} leaf-item`,
342
342
  component: "span",
343
343
  sx: {
344
344
  "& span": {
@@ -365,6 +365,9 @@ export const getMarked = (leaf, children, theme) => {
365
365
  fontWeight: leaf.fontWeight,
366
366
  WebkitTextFillColor: "unset !important"
367
367
  },
368
+ style: {
369
+ "--fontSize_xs": leaf?.fontSize?.xs || "auto"
370
+ },
368
371
  children: children
369
372
  })
370
373
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "9.3.9",
3
+ "version": "9.4.0",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"