@flozy/editor 4.5.7 → 4.5.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. package/dist/Editor/ChatEditor.js +14 -2
  2. package/dist/Editor/CommonEditor.js +19 -16
  3. package/dist/Editor/Editor.css +1 -19
  4. package/dist/Editor/Elements/AI/AIInput.js +5 -4
  5. package/dist/Editor/Elements/AI/PopoverAIInput.js +29 -40
  6. package/dist/Editor/Elements/AI/Styles.js +1 -1
  7. package/dist/Editor/Elements/Button/EditorButton.js +4 -8
  8. package/dist/Editor/Elements/Embed/Embed.css +1 -1
  9. package/dist/Editor/Elements/Embed/Image.js +3 -4
  10. package/dist/Editor/Elements/Embed/Video.js +4 -4
  11. package/dist/Editor/Elements/Form/Form.js +1 -0
  12. package/dist/Editor/Elements/Form/Workflow/FormWorkflow.js +12 -3
  13. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +0 -30
  14. package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +0 -2
  15. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +1 -3
  16. package/dist/Editor/Elements/FreeGrid/Options/AddElement.js +0 -4
  17. package/dist/Editor/Elements/FreeGrid/Options/sectionItemOptions.js +1 -5
  18. package/dist/Editor/Elements/FreeGrid/styles.js +1 -82
  19. package/dist/Editor/Elements/Mentions/Mentions.js +3 -2
  20. package/dist/Editor/Elements/Signature/SignaturePopup.js +7 -24
  21. package/dist/Editor/Elements/Signature/Signed.js +1 -1
  22. package/dist/Editor/Elements/SimpleText/index.js +8 -6
  23. package/dist/Editor/Elements/Table/TableRow.js +1 -1
  24. package/dist/Editor/Styles/EditorStyles.js +2 -2
  25. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +2 -1
  26. package/dist/Editor/Toolbar/PopupTool/ButtonTemplatesCard.js +29 -35
  27. package/dist/Editor/Toolbar/PopupTool/FullViewCard.js +30 -35
  28. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +4 -4
  29. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +38 -22
  30. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +1 -0
  31. package/dist/Editor/Toolbar/PopupTool/index.js +5 -5
  32. package/dist/Editor/common/FontLoader/FontLoader.js +6 -6
  33. package/dist/Editor/common/Icon.js +1 -1
  34. package/dist/Editor/common/RnD/DragOver/index.js +1 -0
  35. package/dist/Editor/common/RnD/ElementOptions/Actions.js +1 -14
  36. package/dist/Editor/common/RnD/ElementOptions/styles.js +0 -5
  37. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +1 -1
  38. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/index.js +2 -32
  39. package/dist/Editor/common/RnD/ElementSettings/settingsConstants.js +1 -2
  40. package/dist/Editor/common/RnD/RnDCopy.js +0 -2
  41. package/dist/Editor/common/RnD/Utils/gridDropItem.js +3 -5
  42. package/dist/Editor/common/RnD/index.js +30 -64
  43. package/dist/Editor/common/Section/index.js +1 -11
  44. package/dist/Editor/common/Section/styles.js +0 -16
  45. package/dist/Editor/common/Shorthands/mentions.js +1 -1
  46. package/dist/Editor/common/iconslist.js +0 -23
  47. package/dist/Editor/helper/index.js +2 -4
  48. package/dist/Editor/hooks/useBreakpoints.js +1 -1
  49. package/dist/Editor/hooks/useMentions.js +39 -13
  50. package/dist/Editor/hooks/useMouseMove.js +4 -5
  51. package/dist/Editor/hooks/withCommon.js +7 -3
  52. package/dist/Editor/plugins/withHTML.js +29 -0
  53. package/dist/Editor/utils/Decorators/index.js +2 -3
  54. package/dist/Editor/utils/RnD/RnDCtrlCmds.js +1 -16
  55. package/dist/Editor/utils/SlateUtilityFunctions.js +0 -18
  56. package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +1 -24
  57. package/dist/Editor/utils/customHooks/useResize.js +5 -4
  58. package/dist/Editor/utils/events.js +0 -36
  59. package/dist/Editor/utils/helper.js +39 -11
  60. package/package.json +1 -1
  61. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Signature.js +0 -53
  62. package/dist/Editor/helper/RnD/focusNode.js +0 -74
  63. package/dist/Editor/hooks/useDragging.js +0 -51
  64. package/dist/Editor/hooks/withRestrictedNodes.js +0 -48
  65. package/dist/Editor/utils/Decorators/highlightSelection.js +0 -16
@@ -224,6 +224,7 @@ const iconList = {
224
224
  fill: "#64748B"
225
225
  }
226
226
  }),
227
+ calenderNewIcon: /*#__PURE__*/_jsx(CalendlyIcon, {}),
227
228
  freegrid: /*#__PURE__*/_jsx(CiGrid32, {
228
229
  size: 20,
229
230
  style: {
@@ -233,7 +234,6 @@ const iconList = {
233
234
  text: /*#__PURE__*/_jsx(Text, {
234
235
  stroke: "#64748B"
235
236
  }),
236
- calenderNewIcon: /*#__PURE__*/_jsx(CalendlyIcon, {}),
237
237
  textArea: /*#__PURE__*/_jsx(TextAreaIcon, {}),
238
238
  phone: /*#__PURE__*/_jsx(Phone, {}),
239
239
  briefCase: /*#__PURE__*/_jsx(BriefCase, {}),
@@ -17,6 +17,7 @@ const DragOver = props => {
17
17
  const open = Boolean(anchorEl);
18
18
  const isSectionHover = status && type === "parent";
19
19
  const isContainerHover = hover_on === path && type === "parent-container";
20
+ console.log(isSectionHover, isContainerHover);
20
21
  useEffect(() => {
21
22
  if (ref?.current) {
22
23
  const getBoundingClientRect = () => ref?.current?.getBoundingClientRect();
@@ -12,8 +12,7 @@ import SaveIcon from "@mui/icons-material/Save";
12
12
  import LinkIcon from "./Icons/LinkIcon";
13
13
  import CodeIcon from "@mui/icons-material/Code";
14
14
  import FilterFramesIcon from "@mui/icons-material/FilterFrames";
15
- import { GridAddSectionIcon, SignatureIcon, WorkflowIcon } from "../../iconslist";
16
- import Delete from "@mui/icons-material/Delete";
15
+ import { GridAddSectionIcon, WorkflowIcon } from "../../iconslist";
17
16
  const Actions = {
18
17
  ai: {
19
18
  type: "ai",
@@ -46,18 +45,6 @@ const Actions = {
46
45
  Icon: LinkIcon,
47
46
  title: "Link"
48
47
  },
49
- signatureSettings: {
50
- type: "signatureSettings",
51
- Button: IconButton,
52
- Icon: SignatureIcon,
53
- title: "Signature"
54
- },
55
- removeSign: {
56
- type: "removeSign",
57
- Button: IconButton,
58
- Icon: Delete,
59
- title: "Remove Sign"
60
- },
61
48
  more: {
62
49
  type: "more",
63
50
  Button: IconButton,
@@ -42,11 +42,6 @@ const useElementOptionsStyle = ({
42
42
  "& .strokePath": {
43
43
  stroke: "#2563EB"
44
44
  }
45
- },
46
- "& .SignatureIcon": {
47
- "& path": {
48
- fill: theme?.palette?.editor?.textColor
49
- }
50
45
  }
51
46
  }
52
47
  }
@@ -12,7 +12,7 @@ const Settings = props => {
12
12
  childType,
13
13
  open,
14
14
  anchorEl,
15
- // placement,
15
+ placement,
16
16
  onClose,
17
17
  editor,
18
18
  classes,
@@ -1,39 +1,9 @@
1
1
  import Settings from "./Settings";
2
2
  import Link from "./Link";
3
3
  import SavePopup from "./SaveAsTemplate";
4
- import Signature from "./Signature";
5
- import { Path, Transforms } from "slate";
6
4
  const OtherSettings = {
7
5
  link: Link,
8
6
  settings: Settings,
9
- saveAsTemplate: SavePopup,
10
- signatureSettings: Signature
7
+ saveAsTemplate: SavePopup
11
8
  };
12
- export default OtherSettings;
13
- export const removeSign = (editor, path = []) => {
14
- const pPath = path?.split("|")?.map(m => parseInt(m));
15
- const element_path = [...pPath, 0];
16
- Transforms.removeNodes(editor, {
17
- at: element_path
18
- }); // remove signature
19
-
20
- Transforms.insertNodes(editor, [{
21
- type: "signature",
22
- children: [{
23
- text: ""
24
- }],
25
- data: {
26
- name: "",
27
- email: "",
28
- date: ""
29
- }
30
- }], {
31
- at: element_path
32
- });
33
- const parentPath = Path.parent(element_path);
34
- Transforms.setNodes(editor, {
35
- childType: "signature"
36
- }, {
37
- at: parentPath
38
- });
39
- };
9
+ export default OtherSettings;
@@ -18,6 +18,5 @@ export const ItemTypes = {
18
18
  appHeader: "App Header",
19
19
  form: "Form",
20
20
  table: "Table",
21
- embedScript: "Code",
22
- signature: "Signature"
21
+ embedScript: "Code"
23
22
  };
@@ -12,8 +12,6 @@ const RnDCopy = props => {
12
12
  useEffect(() => {
13
13
  if (selectedElement?.path) {
14
14
  window.selectedRnDElement = selectedElement;
15
- } else {
16
- window.selectedRnDElement = {};
17
15
  }
18
16
  }, [selectedElement?.path, selectedElement?.enable]);
19
17
  return !readOnly ? /*#__PURE__*/_jsx(Box, {
@@ -123,8 +123,8 @@ export function onDropItem(props, parentClass) {
123
123
  dragOver,
124
124
  parentPath,
125
125
  path,
126
- // diffX,
127
- // x: cx,
126
+ diffX,
127
+ x: cx,
128
128
  breakpoint
129
129
  // calX,
130
130
  } = props;
@@ -134,9 +134,7 @@ export function onDropItem(props, parentClass) {
134
134
  let newPath = [];
135
135
  newPath = moveTo;
136
136
  const cCalx = isContainerElement(editor, moveTo, props);
137
- // const posX = parseInt(
138
- // cx - window.innerWidth / 2 + MARGIN_OF[breakpoint] - diffX
139
- // );
137
+ const posX = parseInt(cx - window.innerWidth / 2 + MARGIN_OF[breakpoint] - diffX);
140
138
  const toSectionNode = Node.get(editor, newPath);
141
139
  const addToSectionDOM = ReactEditor.toDOMNode(editor, toSectionNode);
142
140
  const rect = addToSectionDOM.getBoundingClientRect();
@@ -11,14 +11,12 @@ import DragInfo from "./DragInfo";
11
11
  import GuideLines from "./GuideLines";
12
12
  import ShadowElement from "./ShadowElement";
13
13
  import BoundaryLine from "./GuideLines/BoundaryLine";
14
+ import DragOver from "./DragOver";
14
15
  import ContextMenu from "./ContextMenu";
15
16
  import VirtualElement from "./VirtualElement";
16
17
  import { ItemTypes } from "./ElementSettings/settingsConstants";
17
18
  import { focusSelection, clearSelection } from "../../helper";
18
19
  import { selectText } from "../../utils/helper";
19
- import { removeSign } from "./ElementSettings/OtherSettings";
20
- import useDragging from "../../hooks/useDragging";
21
- import { dragOverOn } from "../../helper/RnD/focusNode";
22
20
  import { jsx as _jsx } from "react/jsx-runtime";
23
21
  import { jsxs as _jsxs } from "react/jsx-runtime";
24
22
  import { Fragment as _Fragment } from "react/jsx-runtime";
@@ -59,6 +57,7 @@ const RnD = props => {
59
57
  const {
60
58
  isSelectedElement,
61
59
  setSelectedElement,
60
+ dragging,
62
61
  updateDragging,
63
62
  contextMenu,
64
63
  setContextMenu,
@@ -76,25 +75,21 @@ const RnD = props => {
76
75
  const open = Boolean(enable);
77
76
  const currentAction = str_path === sp ? selectedAction : null;
78
77
  const positionRef = useRef();
79
- const {
80
- draggingRef,
81
- startDragging,
82
- stopDragging,
83
- setDragOver
84
- } = useDragging();
85
- const dragging = draggingRef?.current;
86
78
  const {
87
79
  active,
88
80
  id,
89
- parentPath
81
+ parentPath,
82
+ dragOver
90
83
  } = dragging;
91
84
  const dragInfoOpen = id === str_path;
85
+ const dragOverStatus = dragOver === str_path && parentPath !== str_path;
92
86
  const [absPosition, setAbsPosition] = useState({});
93
87
  const openContextMenu = contextMenu?.path === str_path;
94
88
  const [position, setPosition] = useState({
95
89
  x: 0,
96
90
  y: 0
97
91
  });
92
+ const pathIsDragging = dragOver === str_path && dragging?.isDragging;
98
93
  const parentSectionPath = str_path?.split("|").slice(0, 2).join("_");
99
94
  useEffect(() => {
100
95
  if (ITEM_TYPES.includes(type)) {
@@ -230,13 +225,6 @@ const RnD = props => {
230
225
  selectedActionPath: path
231
226
  });
232
227
  break;
233
- case "signatureSettings":
234
- setSelectedElement({
235
- ...selectedElementProps,
236
- selectedAction: actionType,
237
- selectedActionPath: path
238
- });
239
- break;
240
228
  case "imageFrame":
241
229
  setSelectedElement({
242
230
  ...selectedElementProps,
@@ -245,9 +233,6 @@ const RnD = props => {
245
233
  selectedActionPath: path
246
234
  });
247
235
  break;
248
- case "removeSign":
249
- removeSign(editor, sp);
250
- break;
251
236
  case "saveAsTemplate":
252
237
  const curPath = type === "parent" ? Path.parent(path) : path;
253
238
  const currentNode = Node.get(editor, curPath);
@@ -285,7 +270,6 @@ const RnD = props => {
285
270
  dragOver: null
286
271
  }, null);
287
272
  }
288
- stopDragging();
289
273
  };
290
274
  const onDragStart = e => {
291
275
  e.preventDefault();
@@ -304,9 +288,6 @@ const RnD = props => {
304
288
  diffX: parseInt(Math.abs(Math.floor(left - e.clientX))),
305
289
  diffY: parseInt(Math.abs(Math.floor(top - e.clientY)))
306
290
  };
307
- const parentPath = getParentSectionPath({
308
- ref
309
- }, ".freegrid-container-parent");
310
291
  updateDragging({
311
292
  ...dragging,
312
293
  active: true,
@@ -319,25 +300,20 @@ const RnD = props => {
319
300
  height
320
301
  },
321
302
  isDragging: 1,
322
- parentPath
303
+ parentPath: getParentSectionPath({
304
+ ref
305
+ }, ".freegrid-container-parent")
323
306
  });
324
307
  setPosition({
325
308
  ...updatedPosition
326
309
  });
327
- startDragging({
328
- active: true,
329
- id: str_path,
330
- position: {
331
- ...updatedPosition
332
- },
333
- isDragging: 1,
334
- parentPath
335
- });
336
310
  }
337
311
  };
338
- const onDrag = e => {
312
+ const onDrag = (e, d) => {
339
313
  e.preventDefault();
314
+ e.stopPropagation();
340
315
  const lines = getClosestDraggable(e.clientX, e.clientY, `.freegrid-section_${parentSectionPath} .freegrid-container .freegrid-item.inactive-drag`.replace(/\|/g, "\\|"), ".freegrid-item.active-drag:not(.exclude-virtual)");
316
+ console.log(lines);
341
317
  setAbsPosition({
342
318
  ...absPosition,
343
319
  "--zIndex": 2000
@@ -357,34 +333,16 @@ const RnD = props => {
357
333
  y: e.clientY,
358
334
  lines: lines
359
335
  });
360
- const isDragOverOnParent = {};
361
- let dragOverEle = e?.toElement?.dataset?.dragovertype !== "child" ? e?.toElement : e?.toElement?.closest(".freegrid-container-parent");
362
-
363
- // some cases
364
- if (dragOverEle?.dataset?.dragovertype === undefined) {
365
- // means check for parent element
366
- dragOverEle = e?.toElement?.parentElement;
367
- }
368
- if (dragOverEle?.dataset?.dragovertype !== "child") {
369
- const oldPath = dragging.dragOver;
370
- isDragOverOnParent.dragOver = dragOverEle?.dataset?.dragoverid;
371
- isDragOverOnParent.dragOverType = dragOverEle?.dataset?.dragovertype;
372
- dragOverOn(oldPath, dragOverEle?.dataset?.dragoverid);
373
- }
374
- startDragging({
375
- isDragging: 2,
376
- ...isDragOverOnParent
377
- });
378
336
  };
379
337
  const onDragStop = (e, d) => {
380
338
  e.preventDefault();
381
339
  e.stopPropagation();
382
- if (dragging?.isDragging === 2 && dragging?.position?.strXY && dragging?.dragOver) {
340
+ if (dragging?.isDragging === 2 && dragging?.position?.strXY) {
383
341
  d.x = e.x;
384
342
  d.y = e.y;
385
343
  d.offsetX = e.offsetX;
386
344
  d.offsetY = e.offsetY;
387
- d.dragOver = dragging?.dragOver;
345
+ d.dragOver = dragOver;
388
346
  d.parentPath = parentPath;
389
347
  d.diffX = position?.diffX;
390
348
  d.diffY = position?.diffY;
@@ -412,11 +370,17 @@ const RnD = props => {
412
370
  setAbsPosition({
413
371
  ...ud
414
372
  });
415
- stopDragging();
416
373
  } else {
417
374
  // invalid drags
418
375
  // found in dev mode and in safari browser
419
- onAfterDrop(path);
376
+ updateDragging({
377
+ isDragging: 0,
378
+ position: {},
379
+ lines: [],
380
+ active: false,
381
+ id: null
382
+ });
383
+ setPosition({});
420
384
  }
421
385
  };
422
386
  const onResizeStop = (e, direction, ref, d, position) => {
@@ -467,9 +431,6 @@ const RnD = props => {
467
431
  e.stopPropagation();
468
432
  }
469
433
  if (type !== "child") {
470
- setDragOver({
471
- dragOver: str_path
472
- });
473
434
  updateDragging({
474
435
  dragOver: str_path
475
436
  }, str_path);
@@ -543,9 +504,14 @@ const RnD = props => {
543
504
  "data-event": "rnd-click",
544
505
  className: "editor-blocker",
545
506
  "data-path": path,
546
- contentEditable: false,
547
- "data-dragOverId": str_path,
548
- "data-dragOverType": type
507
+ contentEditable: false
508
+ }) : null, pathIsDragging ? /*#__PURE__*/_jsx(DragOver, {
509
+ status: dragOverStatus,
510
+ hover_on: dragOver,
511
+ path: str_path,
512
+ parentPath: parentPath,
513
+ type: type,
514
+ childType: childType
549
515
  }) : null]
550
516
  }, eId), !active && rndRef?.current && open ? /*#__PURE__*/_jsx(ElementOptions, {
551
517
  id: `opt_ref_${str_path}`,
@@ -104,13 +104,6 @@ const Section = props => {
104
104
  };
105
105
  const isFreeGrid = element?.children?.find(f => f.type === "freegrid");
106
106
  const needHover = element?.children?.find(f => f.type === "grid" && !list_types.includes(element.type)) ? "needHover" : "";
107
- let tempProps = {};
108
- if (element?.type === "temp") {
109
- tempProps = {
110
- "--left": `${element?.left}px`,
111
- "--top": `${element?.top}px`
112
- };
113
- }
114
107
  const sectionBgImage = sectionBackgroundImage && sectionBackgroundImage !== "none" ? {
115
108
  backgroundImage: `url(${sectionBackgroundImage})`
116
109
  } : {};
@@ -129,10 +122,7 @@ const Section = props => {
129
122
  }, theme);
130
123
  return path.length === 1 && !isFreeGrid ? /*#__PURE__*/_jsxs(Box, {
131
124
  component: "div",
132
- className: `ed-section-wrapper ${readOnly ? "" : "hselect"} ${needHover} is-${element?.type}`,
133
- style: {
134
- ...tempProps
135
- },
125
+ className: `ed-section-wrapper ${readOnly ? "" : "hselect"} ${needHover}`,
136
126
  sx: {
137
127
  ...classes.root,
138
128
  background: sectionBgColor,
@@ -52,22 +52,6 @@ const SectionStyle = theme => ({
52
52
  [theme.breakpoints.between("xs", "md")]: {
53
53
  maxWidth: `320px !important`
54
54
  }
55
- },
56
- "&.is-temp": {
57
- position: "fixed",
58
- background: "transparent",
59
- padding: "12px",
60
- width: "10px",
61
- height: "10px",
62
- left: 0,
63
- top: 0,
64
- bottom: 0,
65
- right: 0,
66
- margin: "auto",
67
- // left: "var(--left)",
68
- // top: "var(--top)",
69
- zIndex: 1000,
70
- pointerEvents: "none"
71
55
  }
72
56
  }
73
57
  });
@@ -3,6 +3,6 @@ const mentions = props => {
3
3
  CHARACTERS,
4
4
  search
5
5
  } = props;
6
- return CHARACTERS.filter(c => c.name.toLowerCase().startsWith(search?.toLowerCase())).slice(0, 10);
6
+ return CHARACTERS.filter(c => c?.name?.toLowerCase()?.startsWith(search?.toLowerCase())).slice(0, 10);
7
7
  };
8
8
  export default mentions;
@@ -2337,27 +2337,4 @@ export const ResetIcon = () => /*#__PURE__*/_jsxs("svg", {
2337
2337
  strokeLinecap: "round",
2338
2338
  strokeLinejoin: "round"
2339
2339
  })]
2340
- });
2341
- export const SignaturePlaceholderIcon = () => /*#__PURE__*/_jsxs("svg", {
2342
- width: "39",
2343
- height: "29",
2344
- viewBox: "0 0 39 29",
2345
- fill: "none",
2346
- xmlns: "http://www.w3.org/2000/svg",
2347
- children: [/*#__PURE__*/_jsx("path", {
2348
- d: "M32.9361 2.30469L18.7107 16.5287C17.8881 17.3501 17.8881 18.6836 18.7107 19.5061L19.4967 20.2922C20.3182 21.1137 21.6528 21.1137 22.4742 20.2922L36.701 6.06677L32.9361 2.30469Z",
2349
- fill: "#64748B"
2350
- }), /*#__PURE__*/_jsx("path", {
2351
- d: "M18.0898 20.1246C17.7023 19.7372 17.4549 19.2631 17.3415 18.7656L17.277 18.9424C17.1454 19.3043 16.9272 19.899 16.7945 20.2609L15.9122 22.6728C15.9074 22.6848 15.906 22.6972 15.9023 22.7056L16.9701 21.6392C17.0787 21.532 17.254 21.532 17.3626 21.6392C17.4711 21.7489 17.4711 21.9245 17.3626 22.0317L16.2962 23.1006C16.3083 23.0958 16.3181 23.0933 16.3304 23.0885L18.7423 22.2073C19.1042 22.0743 19.6978 21.8575 20.0608 21.7248L20.2376 21.6602C19.739 21.5458 19.2649 21.2983 18.8774 20.9132L18.0898 20.1246Z",
2352
- fill: "#64748B"
2353
- }), /*#__PURE__*/_jsx("path", {
2354
- d: "M38.3842 1.40407L37.5982 0.617994C36.7756 -0.205998 35.4421 -0.205998 34.6207 0.617994L33.5664 1.67231L37.3299 5.43583L38.3842 4.38151C39.2057 3.55896 39.2057 2.22547 38.3842 1.40407Z",
2355
- fill: "#64748B"
2356
- }), /*#__PURE__*/_jsx("path", {
2357
- d: "M36.7307 7.02477L30.3199 13.4356C30.0626 13.6928 30.0626 14.1095 30.3199 14.3667C30.5772 14.624 30.9938 14.624 31.251 14.3667L37.6604 7.95591C37.9177 7.69865 37.9177 7.28204 37.6604 7.02477C37.4034 6.76779 36.9865 6.76779 36.7307 7.02477Z",
2358
- fill: "#64748B"
2359
- }), /*#__PURE__*/_jsx("path", {
2360
- d: "M19.034 24.3978H14.2468C12.5175 24.3978 11.4972 24.7574 10.8208 24.9951C10.0347 25.2742 9.97013 25.295 9.23397 24.6259C9.00841 24.4185 8.79632 24.1408 8.57216 23.8445C8.02117 23.1207 7.33161 22.2115 6.14206 22.2833C4.44193 22.3784 4.29183 24.1467 4.20291 25.2035C4.18833 25.3814 4.17121 25.58 4.14821 25.775C4.03234 25.4131 3.9204 25.0181 3.83511 24.7159C3.69624 24.221 3.55232 23.7116 3.39746 23.2826C3.07567 22.3966 2.51371 22.276 2.17738 22.2833C1.84465 22.2906 0.959808 22.3088 0.0410129 25.2229C-0.105155 25.6847 0.151831 26.1773 0.613894 26.3246C1.0782 26.4697 1.57054 26.2124 1.71698 25.7506C1.81208 25.4485 1.92907 25.134 2.04719 24.8512C2.07889 24.9634 2.11171 25.0779 2.14341 25.1912C2.59566 26.7976 2.95282 28.0638 3.9229 28.2955C3.99725 28.3126 4.08982 28.3261 4.19699 28.3261C4.47474 28.3261 4.84534 28.2285 5.20499 27.8337C5.79863 27.1843 5.88139 26.2102 5.95321 25.3534C5.98744 24.9438 6.05196 24.1796 6.23853 24.0371C6.49214 24.0273 6.76625 24.3724 7.17334 24.9085C7.42331 25.2376 7.70723 25.6104 8.05091 25.9224C9.46232 27.2081 10.2594 27.0558 11.4048 26.6512C12.0338 26.4293 12.8174 26.1541 14.2457 26.1541H19.0329C19.518 26.1541 19.9116 25.7591 19.9116 25.2754C19.9127 24.7915 19.5205 24.3979 19.034 24.3979L19.034 24.3978Z",
2361
- fill: "#64748B"
2362
- })]
2363
2340
  });
@@ -4,7 +4,6 @@ import html2canvas from "html2canvas";
4
4
  import { rectIntersection, closestCenter } from "@dnd-kit/core";
5
5
  import { getQueryStrings } from "../utils/SlateUtilityFunctions";
6
6
  import { Node } from "slate";
7
- // import { focusUsingTemporaryNode } from "./RnD/focusNode";
8
7
  const HIDE_PLACHOLDERS = ["grid", "grid-item", "table"];
9
8
  const PREVIEW_IMAGE_HIDE_CLASS = ["grid-container-toolbar", "grid-item-toolbar", "element-toolbar", "mini-tool-wrpr-ei", "element-selector", "element-selector-ctrl"];
10
9
  const RND_ITEMS = ["freegridItem", "freegridBox"];
@@ -255,9 +254,8 @@ export const focusSelection = (editor, {
255
254
  const selectedDOM = ReactEditor.toDOMNode(editor, selectedNode);
256
255
  selectedDOM.scrollIntoView({
257
256
  behavior: "smooth",
258
- block: "nearest"
257
+ block: "center"
259
258
  });
260
- // focusUsingTemporaryNode(editor, selectedDOM);
261
259
  } catch (err) {
262
260
  console.log(err);
263
261
  }
@@ -304,7 +302,7 @@ export const getTextColor = (color = "") => {
304
302
  WebkitTextFillColor: "transparent !important",
305
303
  color: "transparent !important",
306
304
  caretColor: "black",
307
- "& span": {
305
+ '& span': {
308
306
  color: "transparent !important"
309
307
  }
310
308
  } : {
@@ -1,6 +1,6 @@
1
1
  import { useMediaQuery } from "@mui/material";
2
2
  export const STIMULATOR_MOCK = {
3
- xs: "@media (min-width: 1200px) and (max-width: 1980px)"
3
+ xs: "@media (min-width: 1200px) and (max-width: 7680px)"
4
4
  };
5
5
  export const isStimulator = () => {
6
6
  try {
@@ -13,7 +13,7 @@ const getStartEnd = ({
13
13
  // Get start and end, modify it as we move along.
14
14
  let [start, end] = Range.edges(selection);
15
15
 
16
- // Move backwards
16
+ // Move backwards to find the start of the word
17
17
  while (true) {
18
18
  const before = Editor.before(editor, start, {
19
19
  unit: "character"
@@ -22,16 +22,15 @@ const getStartEnd = ({
22
22
  anchor: before,
23
23
  focus: start
24
24
  });
25
- if (before && wordBefore && SHORTHAND_CMDS.indexOf(wordBefore) < 0) {
26
- start = before;
27
- if (start.offset === 0) {
28
- // Means we've wrapped to beginning of another block
25
+ if (before) {
26
+ if (wordBefore.trim() === "") {
27
+ break;
28
+ } else if (SHORTHAND_CMDS.indexOf(wordBefore) < 0) {
29
+ start = before;
30
+ } else {
31
+ start = before;
29
32
  break;
30
33
  }
31
- } else if (SHORTHAND_CMDS.indexOf(wordBefore) >= 0) {
32
- // reached the character end
33
- start = before;
34
- break;
35
34
  } else {
36
35
  break;
37
36
  }
@@ -41,11 +40,38 @@ const getStartEnd = ({
41
40
  focus: end
42
41
  };
43
42
  const word = Editor.string(editor, wordRange);
43
+ const firstChar = word[0];
44
+
45
+ // Handle the commands
46
+ if (firstChar === '@') {
47
+ // Only trigger @ if preceded by a space
48
+ const isPrecededBySpace = Editor.string(editor, {
49
+ anchor: {
50
+ path: start.path,
51
+ offset: start.offset - 1
52
+ },
53
+ focus: start
54
+ }).trim() === "";
55
+ if (isPrecededBySpace) {
56
+ return {
57
+ word,
58
+ search: word.substring(1),
59
+ target: wordRange,
60
+ type: TYPES[firstChar]
61
+ };
62
+ }
63
+ } else if (firstChar === '/') {
64
+ return {
65
+ word,
66
+ search: word.substring(1),
67
+ target: wordRange,
68
+ type: TYPES[firstChar]
69
+ };
70
+ }
44
71
  return {
45
- word,
46
- search: word?.substring(1, word.length),
47
- target: wordRange,
48
- type: TYPES[word[0]]
72
+ word: "",
73
+ wordRange: null,
74
+ type: null
49
75
  };
50
76
  } catch (err) {
51
77
  return {
@@ -98,11 +98,10 @@ export const EditorProvider = ({
98
98
  updateDragging,
99
99
  fontFamilies,
100
100
  setFontFamilies
101
- }), [path, editor?.selection, selectedPath, selectedElement,
102
- // dragging.active,
103
- // dragging.isDragging,
104
- // dragging.dragOver,
105
- contextMenu, openAI, popupType, drop]);
101
+ }), [path, editor?.selection, selectedPath, selectedElement, dragging.active, dragging.isDragging, dragging.dragOver, contextMenu, openAI, popupType, drop
102
+ // fontFamilies,
103
+ ]);
104
+
106
105
  return /*#__PURE__*/_jsx(EditorContext.Provider, {
107
106
  value: otherValues,
108
107
  children: children
@@ -9,8 +9,12 @@ import withLayout from "../plugins/withLayout";
9
9
  import withHtml from "../plugins/withHTML";
10
10
  import withErrorHandling from "./withErrorHandling";
11
11
  import withCustomDeleteBackward from "../plugins/withCustomDeleteBackward";
12
- import withRestrictedNodes from "./withRestrictedNodes";
13
- const withCommon = (props, rest = {}) => {
14
- return rest.needLayout ? withErrorHandling(withHtml(withEquation(withLayout(withHistory(withEmbeds(withTables(withLinks(withMentions(withCustomDeleteBackward(withReact(props))))))))))) : withErrorHandling(withHtml(withEquation(withHistory(withEmbeds(withTables(withLinks(withMentions(withCustomDeleteBackward(withReact(props))))))))));
12
+ const withCommon = (props, {
13
+ needLayout = false,
14
+ isChatEditor = false
15
+ }) => {
16
+ const editor = needLayout ? withErrorHandling(withHtml(withEquation(withLayout(withHistory(withEmbeds(withTables(withLinks(withMentions(withCustomDeleteBackward(withReact(props))))))))))) : withErrorHandling(withHtml(withEquation(withHistory(withEmbeds(withTables(withLinks(withMentions(withCustomDeleteBackward(withReact(props))))))))));
17
+ editor.isChatEditor = isChatEditor;
18
+ return editor;
15
19
  };
16
20
  export default withCommon;
@@ -114,6 +114,23 @@ const withHtml = editor => {
114
114
  const defaultInsert = loopChildren(decoded, true);
115
115
  if (defaultInsert) {
116
116
  insertData(data);
117
+ // } else if (editor.isChatEditor) {
118
+ // // Only convert table to paragraphs if in chat editor mode
119
+ // const paragraphs = decoded.map(row =>
120
+ // row.children.map(cell =>
121
+ // cell.children.map(paragraph =>
122
+ // paragraph.children.map(textNode => textNode.text).join('')
123
+ // ).join(' ')
124
+ // ).join(' ')
125
+ // ).join('\n'); // Joining with a newline for separate paragraphs
126
+
127
+ // // Insert text as paragraphs
128
+ // const textNodes = paragraphs.split('\n').map(text => ({
129
+ // type: 'paragraph',
130
+ // children: [{ text }]
131
+ // }));
132
+
133
+ // Transforms.insertNodes(editor, textNodes);
117
134
  } else {
118
135
  // do not paste table, grid inside table cell
119
136
  // only plain text for internal paste
@@ -127,6 +144,9 @@ const withHtml = editor => {
127
144
  const parsed = new DOMParser().parseFromString(html, "text/html");
128
145
  const isGoogleSheet = parsed.body.querySelector("google-sheets-html-origin");
129
146
  if (isGoogleSheet) {
147
+ if (editor.isChatEditor) {
148
+ return;
149
+ }
130
150
  const table = parsed.body.querySelector("table");
131
151
  const colGrp = table.querySelector("colgroup");
132
152
  if (colGrp) {
@@ -138,6 +158,15 @@ const withHtml = editor => {
138
158
  }
139
159
  const fragment = deserialize(parsed.body);
140
160
  const formattedFragment = formatFragment[eltype] ? formatFragment[eltype](fragment) : fragment;
161
+ let is_img_table = false;
162
+ formattedFragment.map(f => {
163
+ if (f.type === 'image' || f?.type?.includes('table')) {
164
+ is_img_table = true;
165
+ }
166
+ });
167
+ if (editor.isChatEditor && is_img_table) {
168
+ return;
169
+ }
141
170
  handleInsert(editor, () => Transforms.insertFragment(editor, formattedFragment), formattedFragment);
142
171
  return;
143
172
  } else {
@@ -1,6 +1,5 @@
1
- import highlightSelection from "./highlightSelection";
2
1
  import link from "./link";
3
- const decorators = (d, editor) => {
4
- return [...link(d, editor), ...highlightSelection(d, editor)];
2
+ const decorators = d => {
3
+ return [...link(d)];
5
4
  };
6
5
  export default decorators;