@flozy/editor 4.3.9 → 4.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. package/dist/Editor/ChatEditor.js +2 -14
  2. package/dist/Editor/CommonEditor.js +11 -24
  3. package/dist/Editor/Editor.css +7 -1
  4. package/dist/Editor/Elements/AI/Styles.js +0 -1
  5. package/dist/Editor/Elements/Button/EditorButton.js +8 -4
  6. package/dist/Editor/Elements/Embed/Embed.css +1 -1
  7. package/dist/Editor/Elements/Embed/Image.js +2 -1
  8. package/dist/Editor/Elements/Embed/Video.js +2 -1
  9. package/dist/Editor/Elements/Form/Form.js +0 -1
  10. package/dist/Editor/Elements/Form/Workflow/FormWorkflow.js +3 -12
  11. package/dist/Editor/Elements/Mentions/Mentions.js +2 -3
  12. package/dist/Editor/Elements/SimpleText/index.js +3 -2
  13. package/dist/Editor/Elements/Table/TableRow.js +1 -1
  14. package/dist/Editor/Styles/EditorStyles.js +1 -1
  15. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +1 -2
  16. package/dist/Editor/Toolbar/PopupTool/ButtonTemplatesCard.js +35 -29
  17. package/dist/Editor/Toolbar/PopupTool/FullViewCard.js +35 -30
  18. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +0 -2
  19. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +22 -38
  20. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +0 -1
  21. package/dist/Editor/Toolbar/PopupTool/index.js +5 -5
  22. package/dist/Editor/common/FontLoader/FontLoader.js +6 -6
  23. package/dist/Editor/common/Icon.js +1 -1
  24. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/SaveAsTemplate.js +1 -0
  25. package/dist/Editor/common/RnD/index.js +3 -2
  26. package/dist/Editor/common/Section/index.js +11 -1
  27. package/dist/Editor/common/Section/styles.js +14 -0
  28. package/dist/Editor/common/Shorthands/mentions.js +1 -1
  29. package/dist/Editor/helper/RnD/focusNode.js +70 -0
  30. package/dist/Editor/helper/index.js +4 -2
  31. package/dist/Editor/hooks/useBreakpoints.js +1 -1
  32. package/dist/Editor/hooks/useMentions.js +13 -39
  33. package/dist/Editor/hooks/withCommon.js +2 -7
  34. package/dist/Editor/plugins/withHTML.js +0 -29
  35. package/dist/Editor/utils/SlateUtilityFunctions.js +9 -0
  36. package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +24 -1
  37. package/dist/Editor/utils/events.js +36 -0
  38. package/package.json +1 -1
@@ -46,8 +46,7 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
46
46
  const [deboundedValue] = useDebounce(value, 500);
47
47
  const editor = useMemo(() => {
48
48
  return withCommon(createEditor(), {
49
- needLayout,
50
- isChatEditor: true
49
+ needLayout
51
50
  });
52
51
  }, []);
53
52
  const isReadOnly = readOnly === "readonly";
@@ -249,16 +248,6 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
249
248
  restVal
250
249
  });
251
250
  };
252
- const handlePaste = event => {
253
- const items = event.clipboardData.items;
254
- for (let i = 0; i < items.length; i++) {
255
- if (items[i].type.startsWith("image/")) {
256
- event.preventDefault(); // Prevent the default paste behavior
257
- return; // Exit early to keep the editor empty
258
- }
259
- }
260
- };
261
-
262
251
  return /*#__PURE__*/_jsx(EditorProvider, {
263
252
  theme: theme,
264
253
  editor: editor,
@@ -278,8 +267,7 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
278
267
  placeholder: "Start typing ...",
279
268
  spellCheck: true,
280
269
  onBlur: handleBlur,
281
- onKeyDown: onKeyDown,
282
- onPaste: handlePaste
270
+ onKeyDown: onKeyDown
283
271
  }), !readOnly ? /*#__PURE__*/_jsx(MentionsPopup, {
284
272
  ref: mentionsRef,
285
273
  mentions: mentions,
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable no-unused-vars */
2
2
  import React, { useRef, useCallback, useEffect, useMemo, useState, forwardRef, useImperativeHandle } from "react";
3
3
  import PropTypes from "prop-types";
4
- import { createEditor, Transforms, Range } from "slate";
4
+ import { createEditor, Transforms } from "slate";
5
5
  import { Slate, Editable, ReactEditor } from "slate-react";
6
6
  import { useDebounce, useDebouncedCallback } from "use-debounce";
7
7
  import { getMarked, getBlock } from "./utils/SlateUtilityFunctions";
@@ -10,7 +10,7 @@ import { draftToSlate } from "./utils/draftToSlate";
10
10
  import useMentions from "./hooks/useMentions";
11
11
  import MentionsPopup from "./common/MentionsPopup";
12
12
  import { RemoteCursorOverlay } from "./RemoteCursorOverlay/Overlay";
13
- import { mentionsEvent, commands, indentation, escapeEvent, enterEvent } from "./utils/events";
13
+ import { mentionsEvent, commands, indentation, escapeEvent, enterEvent, upDownArrowKeyEvents } from "./utils/events";
14
14
  import withCommon from "./hooks/withCommon";
15
15
  import DialogWrapper from "./DialogWrapper";
16
16
  import { serializeToText } from "./utils/serializeToText";
@@ -33,10 +33,10 @@ import PopoverAIInput from "./Elements/AI/PopoverAIInput";
33
33
  import RnDCopy from "./common/RnD/RnDCopy";
34
34
  import SwitchViewport from "./common/RnD/SwitchViewport/SwitchViewport";
35
35
  import { onInsertFragment } from "./utils/RnD/RnDCtrlCmds";
36
- import FontLoader from "./common/FontLoader/FontLoader";
37
36
  import "./font.css";
38
37
  import "./Editor.css";
39
38
  import "animate.css";
39
+ import FontLoader from "./common/FontLoader/FontLoader";
40
40
  import { jsx as _jsx } from "react/jsx-runtime";
41
41
  import { jsxs as _jsxs } from "react/jsx-runtime";
42
42
  const Item = /*#__PURE__*/forwardRef(({
@@ -365,20 +365,10 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
365
365
  });
366
366
  } else if (event.key === "Enter") {
367
367
  enterEvent(event, editor, customProps?.isMobile);
368
- } else if (event.key === 'Backspace') {
369
- const {
370
- selection
371
- } = editor;
372
- event.preventDefault();
373
- if (selection) {
374
- if (!Range.isCollapsed(selection)) {
375
- editor.deleteFragment();
376
- } else {
377
- editor.deleteBackward({
378
- unit: 'character'
379
- });
380
- }
381
- }
368
+ } else if (event.key === "ArrowUp" && otherProps?.tagName !== 'Pages') {
369
+ upDownArrowKeyEvents(event, editor);
370
+ } else if (event.key === "ArrowDown" && otherProps?.tagName !== 'Pages') {
371
+ upDownArrowKeyEvents(event, editor);
382
372
  }
383
373
  }, [chars, editor, target, mentions, setMentions, search, type, mentionsRef]);
384
374
  const Overlay = collaborativeEditor && !isReadOnly ? RemoteCursorOverlay : React.Fragment;
@@ -443,22 +433,19 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
443
433
  const selection = window?.getSelection();
444
434
  if (selection && selection.rangeCount > 0) {
445
435
  const cursorPosition = selection.getRangeAt(0)?.getBoundingClientRect();
446
- const containerRect = container?.getBoundingClientRect();
447
- const containerBottom = containerRect?.bottom;
436
+ const containerBottom = container?.getBoundingClientRect()?.bottom;
448
437
  if (cursorPosition && cursorPosition.bottom > containerBottom - 250) {
449
- // Calculate dynamic scroll based on remaining space
450
- const scrollAmount = Math.min(200, cursorPosition.bottom - containerBottom + 250);
451
438
  container?.scrollBy({
452
- top: scrollAmount,
439
+ top: 200,
453
440
  behavior: "smooth"
454
441
  });
455
442
  }
456
443
  } else {
457
- console.warn('No valid selection range found');
444
+ console.warn("No valid selection range found");
458
445
  }
459
446
  }
460
447
  } catch (err) {
461
- console.log('handleCursorScroll', err);
448
+ console.log("handleCursorScroll", err);
462
449
  }
463
450
  };
464
451
  return /*#__PURE__*/_jsx(EditorProvider, {
@@ -244,6 +244,13 @@ blockquote {
244
244
  width: 17px !important;
245
245
  }
246
246
 
247
+ .react-datepicker__input-container input {
248
+ height: 40px !important;
249
+ border: 1px solid #ccc;
250
+ border-radius: 5px;
251
+ width: 100%;
252
+ }
253
+
247
254
  .close-popupbtn {
248
255
  border-radius: 4px !important;
249
256
  width: 24px;
@@ -884,7 +891,6 @@ blockquote {
884
891
  /* For Firefox */
885
892
  .removeScroll {
886
893
  -moz-appearance: textfield;
887
- appearance: none;
888
894
  }
889
895
 
890
896
  .borderInput:focus-visible {
@@ -1,6 +1,5 @@
1
1
  const Styles = theme => ({
2
2
  aiContainer: {
3
- background: "#FCFAFF",
4
3
  background: theme?.palette?.editor?.aiInputBackground,
5
4
  border: "1px solid #8360FD",
6
5
  borderRadius: "6px",
@@ -10,10 +10,14 @@ import { getTRBLBreakPoints, getBreakPointsValue, groupByBreakpoint } from "../.
10
10
  import { handleLinkType, windowVar } from "../../utils/helper";
11
11
  import LinkSettings from "../../common/LinkSettings";
12
12
  import Icon from "../../common/Icon";
13
+ import { useEditorContext } from "../../hooks/useMouseMove";
13
14
  import { jsx as _jsx } from "react/jsx-runtime";
14
15
  import { jsxs as _jsxs } from "react/jsx-runtime";
15
16
  const EditorButton = props => {
16
17
  const theme = useTheme();
18
+ const {
19
+ theme: appTheme
20
+ } = useEditorContext();
17
21
  const {
18
22
  attributes,
19
23
  element,
@@ -140,8 +144,8 @@ const EditorButton = props => {
140
144
  sx: {
141
145
  display: "inline-flex",
142
146
  color: "rgba(0, 0, 0, 0.54)",
143
- borderRadius: '50% !important',
144
- border: 'none !important'
147
+ borderRadius: "50% !important",
148
+ border: "none !important"
145
149
  },
146
150
  ...btnProps,
147
151
  children: /*#__PURE__*/_jsx(Icon, {
@@ -212,7 +216,7 @@ const EditorButton = props => {
212
216
  },
213
217
  "& svg": {
214
218
  "& path": {
215
- stroke: theme.palette.text.primary
219
+ stroke: appTheme.palette.text.primary
216
220
  }
217
221
  },
218
222
  "& button": {
@@ -277,7 +281,7 @@ const EditorButton = props => {
277
281
  right: "-42px",
278
282
  stroke: "#fff",
279
283
  "& path": {
280
- fill: openMoreOptions ? theme.palette.text.blueText : ""
284
+ fill: openMoreOptions ? appTheme.palette.text.blueText : ""
281
285
  }
282
286
  },
283
287
  onClick: handleMoreBtn,
@@ -1,5 +1,5 @@
1
1
  .embed {
2
- /* width: fit-content; */
2
+ width: fit-content;
3
3
  position: relative;
4
4
  margin: 0px;
5
5
  }
@@ -94,7 +94,8 @@ const ImageContent = props => {
94
94
  onTouchEnd: onTouchEnd // for mobile
95
95
  ,
96
96
  "data-path": path.join(","),
97
- draggable: false
97
+ draggable: false,
98
+ contentEditable: false
98
99
  });
99
100
  };
100
101
  const Image = props => {
@@ -1,4 +1,4 @@
1
- import React, { useState, useEffect, useCallback } from "react";
1
+ import React, { useState, useEffect } from "react";
2
2
  import { useSlateStatic, ReactEditor } from "slate-react";
3
3
  import { Node, Transforms } from "slate";
4
4
  import { IconButton, Tooltip, Box, useTheme } from "@mui/material";
@@ -220,6 +220,7 @@ const Video = ({
220
220
  alignContent: vertical
221
221
  },
222
222
  ...element.attr,
223
+ contentEditable: false,
223
224
  children: [openSetttings ? /*#__PURE__*/_jsx(EmbedPopup, {
224
225
  element: element,
225
226
  onSave: onSave,
@@ -401,7 +401,6 @@ const Form = props => {
401
401
  component: "button",
402
402
  onClick: onSubmitClick,
403
403
  disabled: loading,
404
- contentEditable: false,
405
404
  sx: {
406
405
  background: buttonProps?.bgColor || "rgb(30, 75, 122)",
407
406
  borderWidth: "1px",
@@ -71,11 +71,11 @@ const FormWorkflow = props => {
71
71
  children: [/*#__PURE__*/_jsx(Grid, {
72
72
  item: true,
73
73
  sx: classes.radioBtn,
74
- children: /*#__PURE__*/_jsxs(RadioGroup, {
74
+ children: /*#__PURE__*/_jsx(RadioGroup, {
75
75
  name: "set timing",
76
76
  value: schedule,
77
77
  defaultValue: 1,
78
- children: [/*#__PURE__*/_jsx(FormControlLabel, {
78
+ children: /*#__PURE__*/_jsx(FormControlLabel, {
79
79
  value: "immediately",
80
80
  label: "Immediately",
81
81
  onChange: () => {
@@ -84,16 +84,7 @@ const FormWorkflow = props => {
84
84
  control: /*#__PURE__*/_jsx(Radio, {
85
85
  size: "small"
86
86
  })
87
- }), /*#__PURE__*/_jsx(FormControlLabel, {
88
- value: "after",
89
- label: "After",
90
- onChange: () => {
91
- setSchedule("after");
92
- },
93
- control: /*#__PURE__*/_jsx(Radio, {
94
- size: "small"
95
- })
96
- })]
87
+ })
97
88
  })
98
89
  }), schedule === "after" && /*#__PURE__*/_jsx(Grid, {
99
90
  item: true,
@@ -14,10 +14,9 @@ const Mentions = ({
14
14
  verticalAlign: "baseline",
15
15
  display: "inline-block",
16
16
  borderRadius: "4px",
17
- backgroundColor: "#2563EB",
17
+ backgroundColor: "#eee",
18
18
  fontSize: "0.9em",
19
- boxShadow: selected && focused ? "0 0 0 2px #B4D5FF" : "none",
20
- color: "#FFF"
19
+ boxShadow: selected && focused ? "0 0 0 2px #B4D5FF" : "none"
21
20
  };
22
21
  // See if our empty text child has any styling marks applied and apply those
23
22
  if (element.children[0].bold) {
@@ -6,6 +6,7 @@ import { isTextSelected } from "../../utils/helper";
6
6
  import { useEditorContext } from "../../hooks/useMouseMove";
7
7
  import SimpleTextStyle from "./style";
8
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
+ import { Fragment as _Fragment } from "react/jsx-runtime";
9
10
  import { jsxs as _jsxs } from "react/jsx-runtime";
10
11
  import { createElement as _createElement } from "react";
11
12
  const SimpleText = props => {
@@ -47,9 +48,9 @@ const SimpleText = props => {
47
48
  sx: classes.root,
48
49
  key: `para_${path.join("|")}`
49
50
  }, children, openAI ? null : /*#__PURE__*/_jsx("span", {
51
+ contentEditable: false,
50
52
  className: "placeholder-simple-text",
51
- children: isEmptyEditor ? editorPlaceholder || "Write Something..." : showPlaceHolder ? opacity && selected ? /*#__PURE__*/_jsxs("span", {
52
- className: "placeholder-simple-text-default",
53
+ children: isEmptyEditor ? editorPlaceholder || "Write Something..." : showPlaceHolder ? opacity && selected ? /*#__PURE__*/_jsxs(_Fragment, {
53
54
  children: ["Type ", /*#__PURE__*/_jsx("span", {
54
55
  style: {
55
56
  backgroundColor: '#F2F6FA',
@@ -23,7 +23,7 @@ const TableRow = props => {
23
23
  return /*#__PURE__*/_jsx("tr", {
24
24
  ...attributes,
25
25
  style: {
26
- background: bgColor,
26
+ backgroundColor: bgColor,
27
27
  border: rowBorderColor ? `1px solid ${rowBorderColor}` : ""
28
28
  },
29
29
  children: children
@@ -215,7 +215,7 @@ const editorStyles = ({
215
215
  },
216
216
  "& .content-editable.empty": {
217
217
  "&:after": {
218
- color: placeHolderColor
218
+ color: theme.palette.type === "dark" ? "#99A5B6" : placeHolderColor
219
219
  }
220
220
  },
221
221
  "& .checkbox-edit": {
@@ -123,8 +123,7 @@ const MiniToolbar = props => {
123
123
  label,
124
124
  icon: Icon
125
125
  }) => {
126
- const isDisabled = popupType === type || type === "undo" ? !canUndo : type === "redo" ? !canRedo : false; // for textFormat type
127
-
126
+ const isDisabled = popupType === type || type === "undo" ? !canUndo : type === "redo" ? !canRedo : false;
128
127
  return /*#__PURE__*/_jsx(Tooltip, {
129
128
  arrow: true,
130
129
  title: label,
@@ -1,22 +1,28 @@
1
1
  import React from "react";
2
- import { Box, Card, CardMedia, Grid } from "@mui/material";
3
-
4
- // const Select = (props) => {
5
- // const { classes, data, onSelectTemplate } = props;
6
- // return (
7
- // <Box
8
- // className="template-card-action"
9
- // component={"div"}
10
- // sx={classes.templateCardBtnGrp}
11
- // style={{ padding: 0, background: "transparent"}}
12
- // >
13
- // <Button className="blueBtn" onClick={onSelectTemplate(data)}>
14
- // Select
15
- // </Button>
16
- // </Box>
17
- // );
18
- // };
2
+ import { Box, Button, Card, CardMedia, Grid } from "@mui/material";
19
3
  import { jsx as _jsx } from "react/jsx-runtime";
4
+ import { jsxs as _jsxs } from "react/jsx-runtime";
5
+ const Select = props => {
6
+ const {
7
+ classes,
8
+ data,
9
+ onSelectTemplate
10
+ } = props;
11
+ return /*#__PURE__*/_jsx(Box, {
12
+ className: "template-card-action",
13
+ component: "div",
14
+ sx: classes.templateCardBtnGrp,
15
+ style: {
16
+ padding: 0,
17
+ background: "transparent"
18
+ },
19
+ children: /*#__PURE__*/_jsx(Button, {
20
+ className: "blueBtn",
21
+ onClick: onSelectTemplate(data),
22
+ children: "Select"
23
+ })
24
+ });
25
+ };
20
26
  const ButtonTemplateCard = props => {
21
27
  const {
22
28
  classes,
@@ -28,19 +34,19 @@ const ButtonTemplateCard = props => {
28
34
  xs: 3,
29
35
  children: /*#__PURE__*/_jsx(Card, {
30
36
  sx: classes.paperOverrides,
31
- children: /*#__PURE__*/_jsx(Box, {
37
+ children: /*#__PURE__*/_jsxs(Box, {
32
38
  sx: classes.buttonCardMediaWrpr,
33
- onClick: onSelectTemplate(m),
34
- children: /*#__PURE__*/_jsx("div", {
35
- className: "img-wrapper",
36
- children: /*#__PURE__*/_jsx(CardMedia, {
37
- className: `template-card-media`,
38
- component: "div",
39
- image: m?.thumbnail,
40
- alt: m?.title,
41
- sx: classes.buttonCardMedia
42
- })
43
- })
39
+ children: [/*#__PURE__*/_jsx(CardMedia, {
40
+ className: `template-card-media`,
41
+ component: "div",
42
+ image: m?.thumbnail,
43
+ alt: m?.title,
44
+ sx: classes.buttonCardMedia
45
+ }), /*#__PURE__*/_jsx(Select, {
46
+ classes: classes,
47
+ onSelectTemplate: onSelectTemplate,
48
+ data: m
49
+ })]
44
50
  })
45
51
  })
46
52
  }, `template_${m.id}`);
@@ -1,22 +1,27 @@
1
1
  import React from "react";
2
- import { Box, Card, CardMedia, Grid } from "@mui/material";
3
-
4
- // const Select = (props) => {
5
- // const { classes, data, onSelectTemplate } = props;
6
- // return (
7
- // <Box
8
- // className="template-card-action"
9
- // component={"div"}
10
- // sx={classes.templateCardBtnGrp}
11
- // style={{background: "transparent"}}
12
- // >
13
- // <Button className="blueBtn" onClick={onSelectTemplate(data)}>
14
- // Select
15
- // </Button>
16
- // </Box>
17
- // );
18
- // };
2
+ import { Box, Button, Card, CardMedia, Grid } from "@mui/material";
19
3
  import { jsx as _jsx } from "react/jsx-runtime";
4
+ import { jsxs as _jsxs } from "react/jsx-runtime";
5
+ const Select = props => {
6
+ const {
7
+ classes,
8
+ data,
9
+ onSelectTemplate
10
+ } = props;
11
+ return /*#__PURE__*/_jsx(Box, {
12
+ className: "template-card-action",
13
+ component: "div",
14
+ sx: classes.templateCardBtnGrp,
15
+ style: {
16
+ background: "transparent"
17
+ },
18
+ children: /*#__PURE__*/_jsx(Button, {
19
+ className: "blueBtn",
20
+ onClick: onSelectTemplate(data),
21
+ children: "Select"
22
+ })
23
+ });
24
+ };
20
25
  const FullViewCard = props => {
21
26
  const {
22
27
  classes,
@@ -30,19 +35,19 @@ const FullViewCard = props => {
30
35
  children: /*#__PURE__*/_jsx(Card, {
31
36
  sx: classes.paperOverrides,
32
37
  className: "paperOverrides",
33
- children: /*#__PURE__*/_jsx(Box, {
34
- sx: classes.fullViewCardMediaWrpr,
35
- onClick: onSelectTemplate(m),
36
- children: /*#__PURE__*/_jsx("div", {
37
- className: "img-wrapper",
38
- children: /*#__PURE__*/_jsx(CardMedia, {
39
- component: "div",
40
- image: m?.thumbnail,
41
- alt: m?.title,
42
- sx: classes.fullViewCardMedia,
43
- className: height
44
- })
45
- })
38
+ children: /*#__PURE__*/_jsxs(Box, {
39
+ sx: classes.buttonCardMediaWrpr,
40
+ children: [/*#__PURE__*/_jsx(CardMedia, {
41
+ component: "div",
42
+ image: m?.thumbnail,
43
+ alt: m?.title,
44
+ sx: classes.fullViewCardMedia,
45
+ className: height
46
+ }), /*#__PURE__*/_jsx(Select, {
47
+ classes: classes,
48
+ onSelectTemplate: onSelectTemplate,
49
+ data: m
50
+ })]
46
51
  })
47
52
  })
48
53
  }, `template_${m.id}`);
@@ -13,7 +13,6 @@ import PopperHeader from "../PopperHeader";
13
13
  import MiniColorPicker from "./MiniColorPicker";
14
14
  import SelectAlignment from "./SelectAlignment";
15
15
  import SelectFontSize from "./SelectFontSize";
16
- // import InfinityAITool from "./InfinityAITool";
17
16
  import { jsx as _jsx } from "react/jsx-runtime";
18
17
  import { jsxs as _jsxs } from "react/jsx-runtime";
19
18
  const DEFAULT_COLOR = {
@@ -28,7 +27,6 @@ const MiniTextFormat = props => {
28
27
  classes,
29
28
  editor,
30
29
  closeMainPopup
31
- // customProps
32
30
  } = props;
33
31
  const [anchorEl, setAnchorEl] = useState(null);
34
32
  const open = Boolean(anchorEl);
@@ -3,9 +3,10 @@ const usePopupStyle = theme => ({
3
3
  boxShadow: "1px 2px 15px 0px #2563EB40",
4
4
  zIndex: 1300,
5
5
  marginBottom: "12px !important",
6
- border: "1px solid #D8DDE1",
7
6
  borderRadius: "6px",
7
+ border: "1px solid #D8DDE1",
8
8
  maxWidth: "100%",
9
+ // maxHeight: "40px",
9
10
  "&.fullscreen": {
10
11
  marginBottom: "0px !important",
11
12
  "& .papper-wrpr": {
@@ -481,10 +482,9 @@ const usePopupStyle = theme => ({
481
482
  }
482
483
  },
483
484
  fullViewCardMedia: {
484
- margin: "5px 0px",
485
485
  width: "100%",
486
486
  backgroundPosition: "left top",
487
- backgroundSize: "100%, auto",
487
+ backgroundSize: "100% auto",
488
488
  zIndex: 1,
489
489
  position: "relative",
490
490
  "&.fullscreen": {
@@ -499,10 +499,9 @@ const usePopupStyle = theme => ({
499
499
  }
500
500
  },
501
501
  buttonCardMedia: {
502
- margin: "5px 0px",
503
502
  width: "100%",
504
- height: "40px",
505
- backgroundPosition: "center",
503
+ height: "48px",
504
+ backgroundPosition: "left top",
506
505
  backgroundSize: "contain",
507
506
  zIndex: 1,
508
507
  position: "relative",
@@ -511,25 +510,26 @@ const usePopupStyle = theme => ({
511
510
  }
512
511
  },
513
512
  buttonCardMediaWrpr: {
514
- padding: "5px",
515
513
  position: "relative",
516
514
  margin: "8px",
517
- height: "50px",
518
- "& .img-wrapper": {
519
- "&:hover": {
520
- padding: "0px 2px 0px 2px",
521
- backgroundColor: "#E9F3FE",
522
- border: "1px solid #2563EB40",
523
- borderRadius: "5px",
524
- // height: "100%",
525
- margin: "0px"
526
- // "& .template-card-action": {
527
- // display: "flex",
528
- // },
515
+ marginBottom: "0px",
516
+ "&:hover": {
517
+ "& .template-card-action": {
518
+ display: "flex"
529
519
  }
520
+ },
521
+ "& .img-loader-wrapper": {
522
+ position: "absolute",
523
+ width: "12px",
524
+ height: "12px",
525
+ left: 0,
526
+ right: 0,
527
+ top: 0,
528
+ bottom: 0,
529
+ margin: "auto",
530
+ zIndex: 0
530
531
  }
531
532
  },
532
-
533
533
  paperOverrides: {
534
534
  "&.MuiPaper-root": {
535
535
  background: "transparent",
@@ -587,13 +587,12 @@ const usePopupStyle = theme => ({
587
587
  },
588
588
  customSelectPopoverWrapper: {
589
589
  "& .MuiPopover-paper": {
590
+ maxHeight: "140px",
590
591
  // minWidth: "130px",
591
592
  border: "1px solid #E4E8EB",
592
- maxHeight: "140px",
593
593
  background: `${theme?.palette?.editor?.background} !important`,
594
- // overflowY: "hidden",
595
- padding: "6px 12px 6px 0px",
596
594
  overflowY: "scroll",
595
+ padding: "6px 12px 6px 0px",
597
596
  "@media only screen and (max-width: 600px)": {
598
597
  marginTop: "-40px"
599
598
  }
@@ -643,21 +642,6 @@ const usePopupStyle = theme => ({
643
642
  "& fieldset": {
644
643
  border: "none !important"
645
644
  }
646
- },
647
- fullViewCardMediaWrpr: {
648
- padding: "5px",
649
- position: "relative",
650
- margin: "8px",
651
- height: "140px",
652
- "& .img-wrapper": {
653
- "&:hover": {
654
- padding: "0px 2px 0px 2px",
655
- backgroundColor: "#E9F3FE",
656
- border: "1px solid #2563EB40",
657
- borderRadius: "5px",
658
- margin: "0px"
659
- }
660
- }
661
645
  }
662
646
  });
663
647
  export default usePopupStyle;
@@ -27,7 +27,6 @@ const TextFormat = props => {
27
27
  onClose,
28
28
  closeMainPopup
29
29
  } = props;
30
- console.log("PROPS:", props);
31
30
  const [anchorEl, setAnchorEl] = useState(null);
32
31
  const [type, setType] = useState(null);
33
32
  const open = Boolean(anchorEl);
@@ -80,16 +80,16 @@ const PopupTool = props => {
80
80
  updateAnchorEl();
81
81
  }
82
82
  }, [selection]);
83
- const handleClose = () => {
84
- setAnchorEl(null);
85
- setOpen(false);
86
- setPopupType("");
87
- };
88
83
  useEffect(() => {
89
84
  if (selectedElement?.enable === 1) {
90
85
  setAnchorEl(null);
91
86
  }
92
87
  }, [selection, selectedElement?.path, selectedElement?.enable]);
88
+ const handleClose = () => {
89
+ setAnchorEl(null);
90
+ setOpen(false);
91
+ setPopupType("");
92
+ };
93
93
  return open && !openAI ? /*#__PURE__*/_jsx(ClickAwayListener, {
94
94
  onClickAway: e => {
95
95
  // close the mini toolbar, if user clicks outside the editor (in Flozy app.)
@@ -1,7 +1,7 @@
1
1
  import { useEffect } from "react";
2
2
  import WebFont from "webfontloader";
3
3
  import { useEditorContext } from "../../hooks/useMouseMove";
4
- const defaultFonts = ['PoppinsRegular', 'PoppinsBold', 'Helvetica', 'Georgia', 'Times New Roman', 'Monaco', 'Courier New', 'Qwitcher Grypen', 'EB Garamond', 'Anton', 'DM Serif Text', 'Libre Baskerville', 'Montserrat', 'Open Sans', 'Public Sans', 'Raleway', 'Space Mono', 'Bulgarian Garamond', 'Impact', 'Redacted Script', 'Great Vibes', 'Zeyada', 'Allura', 'Pinyon Script', 'Herr Von Muellerhoff', 'Dawning of a New Day', 'Coming Soon', 'Dancing Script', 'Engagement', 'Gaegu', 'Ingrid Darling', 'Kite One', 'La Belle Aurore', 'Mea Culpa', 'Meddon', 'Merriweather', 'The Girl Next Door'];
4
+ const defaultFonts = ["PoppinsRegular", "PoppinsBold", "Helvetica", "Georgia", "Times New Roman", "Monaco", "Courier New", "Qwitcher Grypen", "EB Garamond", "Anton", "DM Serif Text", "Libre Baskerville", "Montserrat", "Open Sans", "Public Sans", "Raleway", "Space Mono", "Bulgarian Garamond", "Impact", "Redacted Script", "Great Vibes", "Zeyada", "Allura", "Pinyon Script", "Herr Von Muellerhoff", "Dawning of a New Day", "Coming Soon", "Dancing Script", "Engagement", "Gaegu", "Ingrid Darling", "Kite One", "La Belle Aurore", "Mea Culpa", "Meddon", "Merriweather", "The Girl Next Door"];
5
5
  const FontLoader = props => {
6
6
  const {
7
7
  otherProps,
@@ -15,7 +15,7 @@ const FontLoader = props => {
15
15
  let retryCount = 0;
16
16
  function loadNextBatch() {
17
17
  if (currentIndex >= families?.length) {
18
- console.log('All fonts have been loaded');
18
+ console.log("All fonts have been loaded");
19
19
  return;
20
20
  }
21
21
  const batch = families?.slice(currentIndex, currentIndex + batchSize);
@@ -68,13 +68,13 @@ const FontLoader = props => {
68
68
  });
69
69
  } else {
70
70
  function correctFontArray(fontString) {
71
- let fontsArray = fontString.split(',');
71
+ let fontsArray = fontString.split(",");
72
72
  let cleanedFontsArray = [...new Set(fontsArray.map(font => font.trim()))];
73
73
  return cleanedFontsArray;
74
74
  }
75
75
  function sanitizeFontFamily(fontFamily) {
76
76
  const correctedFonts = correctFontArray(fontFamily);
77
- return correctedFonts.join(', ');
77
+ return correctedFonts.join(", ");
78
78
  }
79
79
  const elements = Array.from(document?.querySelectorAll("*"));
80
80
  const fontSet = new Set();
@@ -83,8 +83,8 @@ const FontLoader = props => {
83
83
  fontSet.add(sanitizeFontFamily(computedStyles?.fontFamily));
84
84
  });
85
85
  let families = Array.from(fontSet);
86
- families = correctFontArray(families.join(', '));
87
- families = families.map(font => font.replace(/\"/g, ''));
86
+ families = correctFontArray(families.join(", "));
87
+ families = families.map(font => font.replace(/\"/g, ""));
88
88
  loadFontsInBatches(families);
89
89
  }
90
90
  }, []);
@@ -224,7 +224,6 @@ const iconList = {
224
224
  fill: "#64748B"
225
225
  }
226
226
  }),
227
- calenderNewIcon: /*#__PURE__*/_jsx(CalendlyIcon, {}),
228
227
  freegrid: /*#__PURE__*/_jsx(CiGrid32, {
229
228
  size: 20,
230
229
  style: {
@@ -234,6 +233,7 @@ const iconList = {
234
233
  text: /*#__PURE__*/_jsx(Text, {
235
234
  stroke: "#64748B"
236
235
  }),
236
+ calenderNewIcon: /*#__PURE__*/_jsx(CalendlyIcon, {}),
237
237
  textArea: /*#__PURE__*/_jsx(TextAreaIcon, {}),
238
238
  phone: /*#__PURE__*/_jsx(Phone, {}),
239
239
  briefCase: /*#__PURE__*/_jsx(BriefCase, {}),
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import { Node } from "slate";
2
3
  import { Dialog, DialogContent, DialogTitle, IconButton } from "@mui/material";
3
4
  import SaveAsTemplate from "../../../StyleBuilder/fieldTypes/saveAsTemplate";
4
5
  import { CloseIcon } from "../../../iconslist";
@@ -155,6 +155,7 @@ const RnD = props => {
155
155
  switch (e.detail) {
156
156
  case 1:
157
157
  if (!enable) {
158
+ // focusSelection(editor, { path });
158
159
  setSelectedElement({
159
160
  path: str_path,
160
161
  enable: 1,
@@ -162,7 +163,6 @@ const RnD = props => {
162
163
  anchorEl: rndRef?.current
163
164
  });
164
165
  }
165
- // ReactEditor.focus(editor);
166
166
  break;
167
167
  case 2:
168
168
  focusSelection(editor, {
@@ -270,7 +270,9 @@ const RnD = props => {
270
270
  dragOver: null
271
271
  }, null);
272
272
  }
273
+ // focusSelection(editor, { path: updated_at });
273
274
  };
275
+
274
276
  const onDragStart = e => {
275
277
  e.preventDefault();
276
278
  if (e?.target?.dataset?.path?.split(",").join("|") === sp) {
@@ -312,7 +314,6 @@ const RnD = props => {
312
314
  const onDrag = (e, d) => {
313
315
  e.preventDefault();
314
316
  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)");
315
- console.log(lines);
316
317
  setAbsPosition({
317
318
  ...absPosition,
318
319
  "--zIndex": 2000
@@ -104,6 +104,13 @@ 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
+ }
107
114
  const sectionBgImage = sectionBackgroundImage && sectionBackgroundImage !== "none" ? {
108
115
  backgroundImage: `url(${sectionBackgroundImage})`
109
116
  } : {};
@@ -122,7 +129,10 @@ const Section = props => {
122
129
  }, theme);
123
130
  return path.length === 1 && !isFreeGrid ? /*#__PURE__*/_jsxs(Box, {
124
131
  component: "div",
125
- className: `ed-section-wrapper ${readOnly ? "" : "hselect"} ${needHover}`,
132
+ className: `ed-section-wrapper ${readOnly ? "" : "hselect"} ${needHover} is-${element?.type}`,
133
+ style: {
134
+ ...tempProps
135
+ },
126
136
  sx: {
127
137
  ...classes.root,
128
138
  background: sectionBgColor,
@@ -52,6 +52,20 @@ 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: "red",
59
+ padding: "12px",
60
+ width: "10px",
61
+ height: "10px",
62
+ // left: 0,
63
+ // top: 0,
64
+ margin: "auto",
65
+ left: "var(--left)",
66
+ top: "var(--top)",
67
+ zIndex: 1000,
68
+ pointerEvents: "none"
55
69
  }
56
70
  }
57
71
  });
@@ -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;
@@ -0,0 +1,70 @@
1
+ import { Editor, Transforms } from "slate";
2
+ import { ReactEditor } from "slate-react";
3
+ const TEMP_NODE_ID = "temp-focus-node";
4
+ const ensureTemporaryFocusNode = (editor, selectedDOM) => {
5
+ // Check if the temporary focus node already exists
6
+ const {
7
+ left,
8
+ top
9
+ } = selectedDOM?.getBoundingClientRect();
10
+ const [tempNodeEntry] = Editor.nodes(editor, {
11
+ at: [],
12
+ match: n => n.temp === TEMP_NODE_ID
13
+ });
14
+ if (!tempNodeEntry) {
15
+ // If not, insert the temporary focus node at the start of the editor
16
+ Transforms.insertNodes(editor, {
17
+ type: "temp",
18
+ temp: TEMP_NODE_ID,
19
+ children: [{
20
+ text: ""
21
+ }],
22
+ left,
23
+ top
24
+ }, {
25
+ at: [editor.children.length]
26
+ });
27
+ } else {
28
+ Transforms.setNodes(editor, {
29
+ type: "temp",
30
+ temp: TEMP_NODE_ID,
31
+ children: [{
32
+ text: ""
33
+ }],
34
+ left,
35
+ top
36
+ }, {
37
+ at: tempNodeEntry[1]
38
+ });
39
+ }
40
+ };
41
+ export const focusUsingTemporaryNode = (editor, selectedDOM) => {
42
+ // de-select and select
43
+ Transforms.deselect(editor);
44
+
45
+ // Ensure the temporary node exists
46
+ ensureTemporaryFocusNode(editor, selectedDOM);
47
+
48
+ // Select the temporary node without causing scroll
49
+ const [tempNodeEntry] = Editor.nodes(editor, {
50
+ at: [],
51
+ match: n => n.temp === TEMP_NODE_ID
52
+ });
53
+ if (tempNodeEntry) {
54
+ const [, path] = tempNodeEntry;
55
+ Transforms.select(editor, path); // Move selection to the temp node
56
+ }
57
+
58
+ ReactEditor.focus(editor);
59
+ };
60
+ export const cleanupTemporaryFocusNode = editor => {
61
+ // Remove the temporary focus node if it exists
62
+ for (const [node, path] of Editor.nodes(editor, {
63
+ at: [],
64
+ match: n => n.temp === TEMP_NODE_ID
65
+ })) {
66
+ Transforms.removeNodes(editor, {
67
+ at: path
68
+ });
69
+ }
70
+ };
@@ -4,6 +4,7 @@ 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";
7
8
  const HIDE_PLACHOLDERS = ["grid", "grid-item", "table"];
8
9
  const PREVIEW_IMAGE_HIDE_CLASS = ["grid-container-toolbar", "grid-item-toolbar", "element-toolbar", "mini-tool-wrpr-ei", "element-selector", "element-selector-ctrl"];
9
10
  const RND_ITEMS = ["freegridItem", "freegridBox"];
@@ -254,8 +255,9 @@ export const focusSelection = (editor, {
254
255
  const selectedDOM = ReactEditor.toDOMNode(editor, selectedNode);
255
256
  selectedDOM.scrollIntoView({
256
257
  behavior: "smooth",
257
- block: "center"
258
+ block: "nearest"
258
259
  });
260
+ // focusUsingTemporaryNode(editor, selectedDOM);
259
261
  } catch (err) {
260
262
  console.log(err);
261
263
  }
@@ -302,7 +304,7 @@ export const getTextColor = (color = "") => {
302
304
  WebkitTextFillColor: "transparent !important",
303
305
  color: "transparent !important",
304
306
  caretColor: "black",
305
- '& span': {
307
+ "& span": {
306
308
  color: "transparent !important"
307
309
  }
308
310
  } : {
@@ -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: 7680px)"
3
+ xs: "@media (min-width: 1200px) and (max-width: 1980px)"
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 to find the start of the word
16
+ // Move backwards
17
17
  while (true) {
18
18
  const before = Editor.before(editor, start, {
19
19
  unit: "character"
@@ -22,15 +22,16 @@ const getStartEnd = ({
22
22
  anchor: before,
23
23
  focus: start
24
24
  });
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;
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
32
29
  break;
33
30
  }
31
+ } else if (SHORTHAND_CMDS.indexOf(wordBefore) >= 0) {
32
+ // reached the character end
33
+ start = before;
34
+ break;
34
35
  } else {
35
36
  break;
36
37
  }
@@ -40,38 +41,11 @@ const getStartEnd = ({
40
41
  focus: end
41
42
  };
42
43
  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
- }
71
44
  return {
72
- word: "",
73
- wordRange: null,
74
- type: null
45
+ word,
46
+ search: word?.substring(1, word.length),
47
+ target: wordRange,
48
+ type: TYPES[word[0]]
75
49
  };
76
50
  } catch (err) {
77
51
  return {
@@ -9,12 +9,7 @@ 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
- 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;
12
+ const withCommon = (props, rest = {}) => {
13
+ 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))))))))));
19
14
  };
20
15
  export default withCommon;
@@ -114,23 +114,6 @@ 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);
134
117
  } else {
135
118
  // do not paste table, grid inside table cell
136
119
  // only plain text for internal paste
@@ -144,9 +127,6 @@ const withHtml = editor => {
144
127
  const parsed = new DOMParser().parseFromString(html, "text/html");
145
128
  const isGoogleSheet = parsed.body.querySelector("google-sheets-html-origin");
146
129
  if (isGoogleSheet) {
147
- if (editor.isChatEditor) {
148
- return;
149
- }
150
130
  const table = parsed.body.querySelector("table");
151
131
  const colGrp = table.querySelector("colgroup");
152
132
  if (colGrp) {
@@ -158,15 +138,6 @@ const withHtml = editor => {
158
138
  }
159
139
  const fragment = deserialize(parsed.body);
160
140
  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
- }
170
141
  handleInsert(editor, () => Transforms.insertFragment(editor, formattedFragment), formattedFragment);
171
142
  return;
172
143
  } else {
@@ -529,6 +529,15 @@ export const getBlock = props => {
529
529
  return /*#__PURE__*/_jsx(Code, {
530
530
  ...props
531
531
  });
532
+ // RnD Focus Node
533
+ case "temp":
534
+ return /*#__PURE__*/_jsx("span", {
535
+ ...attributes,
536
+ ...element.attr,
537
+ contentEditable: false,
538
+ className: "temp-focus-node",
539
+ children: children
540
+ });
532
541
  default:
533
542
  return /*#__PURE__*/_jsx(SimpleText, {
534
543
  ...props,
@@ -1,6 +1,9 @@
1
1
  import { Editor, Transforms, Element as SlateElement } from "slate";
2
2
  import { Box } from "@mui/material";
3
3
  import { fontFamilyMap, sizeMap } from "../font";
4
+ import Table from "../../Elements/Table/Table";
5
+ import TableRow from "../../Elements/Table/TableRow";
6
+ import TableCell from "../../Elements/Table/TableCell";
4
7
  import Mentions from "../../Elements/Mentions/Mentions";
5
8
  import CheckList from "../../Elements/List/CheckList";
6
9
  import { isEmptyTextNode } from "../../helper";
@@ -337,11 +340,31 @@ export const getBlock = props => {
337
340
  ...props,
338
341
  isEmpty: isEmpty
339
342
  });
343
+ case "table":
344
+ return /*#__PURE__*/_jsx(Table, {
345
+ ...props
346
+ });
347
+ case "table-head":
348
+ return /*#__PURE__*/_jsx("thead", {
349
+ children: children
350
+ });
351
+ case "table-body":
352
+ return /*#__PURE__*/_jsx("tbody", {
353
+ children: children
354
+ });
355
+ case "table-row":
356
+ return /*#__PURE__*/_jsx(TableRow, {
357
+ ...props
358
+ });
359
+ case "table-cell":
360
+ return /*#__PURE__*/_jsx(TableCell, {
361
+ ...props
362
+ });
340
363
  case "mention":
341
364
  return /*#__PURE__*/_jsx(Mentions, {
342
365
  ...props
343
366
  });
344
367
  default:
345
- return null;
368
+ return;
346
369
  }
347
370
  };
@@ -285,4 +285,40 @@ export const enterEvent = (e, editor, isMobile) => {
285
285
  } catch (err) {
286
286
  console.log(err);
287
287
  }
288
+ };
289
+ export const upDownArrowKeyEvents = (e, editor) => {
290
+ try {
291
+ const {
292
+ selection
293
+ } = editor;
294
+ if (!selection || Range.isCollapsed(selection)) {
295
+ return;
296
+ }
297
+ const parentPath = selection.anchor.path.slice(0, -1);
298
+ const nextNodePath = [...parentPath];
299
+ const index = parentPath[parentPath.length - 1];
300
+ const parentNode = Editor.parent(editor, parentPath);
301
+ if (parentNode.children[index + 1]) {
302
+ nextNodePath[parentPath.length - 1] += 1;
303
+ } else {
304
+ return;
305
+ }
306
+ Transforms.move(editor, {
307
+ distance: 0,
308
+ unit: 'offset',
309
+ reverse: false
310
+ });
311
+ Transforms.select(editor, {
312
+ anchor: {
313
+ path: nextNodePath,
314
+ offset: 0
315
+ },
316
+ focus: {
317
+ path: nextNodePath,
318
+ offset: 0
319
+ }
320
+ });
321
+ } catch (err) {
322
+ console.log(err);
323
+ }
288
324
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "4.3.9",
3
+ "version": "4.4.0",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"