@flozy/editor 4.0.0 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. package/dist/Editor/ChatEditor.js +28 -17
  2. package/dist/Editor/CommonEditor.js +109 -177
  3. package/dist/Editor/Editor.css +13 -8
  4. package/dist/Editor/Elements/AI/AIInput.js +24 -18
  5. package/dist/Editor/Elements/AI/CustomSelect.js +12 -19
  6. package/dist/Editor/Elements/AI/PopoverAIInput.js +89 -66
  7. package/dist/Editor/Elements/AI/Styles.js +1 -2
  8. package/dist/Editor/Elements/AI/helper.js +3 -5
  9. package/dist/Editor/Elements/Accordion/Accordion.js +1 -1
  10. package/dist/Editor/Elements/Accordion/AccordionSummary.js +21 -5
  11. package/dist/Editor/Elements/AppHeader/AppHeader.js +4 -26
  12. package/dist/Editor/Elements/Button/EditorButton.js +16 -28
  13. package/dist/Editor/Elements/Color Picker/ColorButtons.js +17 -60
  14. package/dist/Editor/Elements/Color Picker/ColorPicker.css +1 -25
  15. package/dist/Editor/Elements/Color Picker/ColorPicker.js +4 -4
  16. package/dist/Editor/Elements/Color Picker/Styles.js +1 -2
  17. package/dist/Editor/Elements/Emoji/EmojiPicker.js +4 -2
  18. package/dist/Editor/Elements/Form/Workflow/FormWorkflow.js +3 -12
  19. package/dist/Editor/Elements/Form/Workflow/UserInputs.js +1 -2
  20. package/dist/Editor/Elements/Grid/Grid.js +3 -27
  21. package/dist/Editor/Elements/Grid/GridItem.js +1 -3
  22. package/dist/Editor/Elements/Link/Link.js +1 -6
  23. package/dist/Editor/Elements/Link/LinkButton.js +2 -4
  24. package/dist/Editor/Elements/Link/LinkPopup.js +3 -10
  25. package/dist/Editor/Elements/List/CheckList.js +2 -1
  26. package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +3 -3
  27. package/dist/Editor/Elements/Signature/SignaturePopup.js +5 -20
  28. package/dist/Editor/Elements/Table/Styles.js +1 -23
  29. package/dist/Editor/Elements/Table/Table.js +1 -2
  30. package/dist/Editor/Elements/Table/TableCell.js +7 -69
  31. package/dist/Editor/Elements/TableContextMenu/TableContextMenu.js +0 -1
  32. package/dist/Editor/MiniEditor.js +1 -3
  33. package/dist/Editor/Styles/EditorStyles.js +1 -1
  34. package/dist/Editor/Toolbar/Basic/index.js +2 -4
  35. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +2 -26
  36. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
  37. package/dist/Editor/Toolbar/FormatTools/TextSize.js +18 -29
  38. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +2 -4
  39. package/dist/Editor/Toolbar/Mini/Options/Options.js +0 -10
  40. package/dist/Editor/Toolbar/Mini/Styles.js +0 -7
  41. package/dist/Editor/Toolbar/PopupTool/ButtonTemplatesCard.js +13 -12
  42. package/dist/Editor/Toolbar/PopupTool/FullViewCard.js +13 -12
  43. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +11 -4
  44. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +86 -213
  45. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +1 -2
  46. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +33 -40
  47. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +7 -52
  48. package/dist/Editor/Toolbar/PopupTool/index.js +6 -7
  49. package/dist/Editor/Toolbar/toolbarGroups.js +6 -48
  50. package/dist/Editor/assets/svg/AIIcons.js +1 -153
  51. package/dist/Editor/assets/svg/AddTemplateIcon.js +10 -13
  52. package/dist/Editor/assets/svg/TextIcon.js +5 -8
  53. package/dist/Editor/common/ColorPickerButton.js +18 -26
  54. package/dist/Editor/common/DnD/DragHandleButton.js +47 -56
  55. package/dist/Editor/common/Icon.js +3 -43
  56. package/dist/Editor/common/LinkSettings/NavComponents.js +2 -5
  57. package/dist/Editor/common/LinkSettings/index.js +2 -4
  58. package/dist/Editor/common/LinkSettings/navOptions.js +2 -7
  59. package/dist/Editor/common/LinkSettings/style.js +8 -11
  60. package/dist/Editor/common/Section/index.js +7 -57
  61. package/dist/Editor/common/Section/styles.js +0 -11
  62. package/dist/Editor/common/Shorthands/elements.js +0 -54
  63. package/dist/Editor/common/StyleBuilder/accordionTitleBtnStyle.js +2 -1
  64. package/dist/Editor/common/StyleBuilder/buttonStyle.js +2 -4
  65. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +29 -33
  66. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +25 -31
  67. package/dist/Editor/common/StyleBuilder/fieldTypes/buttonLink.js +1 -1
  68. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +7 -29
  69. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +4 -13
  70. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +4 -14
  71. package/dist/Editor/common/StyleBuilder/index.js +1 -1
  72. package/dist/Editor/common/iconslist.js +31 -0
  73. package/dist/Editor/helper/index.js +22 -0
  74. package/dist/Editor/helper/theme.js +4 -189
  75. package/dist/Editor/hooks/useMouseMove.js +1 -4
  76. package/dist/Editor/hooks/useWindowMessage.js +7 -10
  77. package/dist/Editor/plugins/withEmbeds.js +1 -1
  78. package/dist/Editor/plugins/withHTML.js +1 -1
  79. package/dist/Editor/plugins/withTable.js +1 -1
  80. package/dist/Editor/theme/ThemeList.js +173 -50
  81. package/dist/Editor/utils/SlateUtilityFunctions.js +27 -169
  82. package/dist/Editor/utils/button.js +17 -1
  83. package/dist/Editor/utils/events.js +2 -54
  84. package/dist/Editor/utils/font.js +37 -40
  85. package/dist/Editor/utils/helper.js +2 -31
  86. package/dist/Editor/utils/table.js +43 -51
  87. package/package.json +3 -4
  88. package/dist/Editor/Elements/AI/VoiceToText/AudioWave.js +0 -73
  89. package/dist/Editor/Elements/AI/VoiceToText/index.js +0 -184
  90. package/dist/Editor/Elements/AI/VoiceToText/style.js +0 -40
  91. package/dist/Editor/Elements/Link/LinkPopupStyles.js +0 -28
  92. package/dist/Editor/Elements/Redo/RedoButton.js +0 -14
  93. package/dist/Editor/Elements/Undo/UndoButton.js +0 -14
  94. package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +0 -438
  95. package/dist/Editor/assets/svg/RedoIcon.js +0 -27
  96. package/dist/Editor/assets/svg/SettingsIcon.js +0 -28
  97. package/dist/Editor/assets/svg/ThemeIcons.js +0 -291
  98. package/dist/Editor/assets/svg/UndoIcon.js +0 -27
  99. package/dist/Editor/common/CustomColorPicker/index.js +0 -106
  100. package/dist/Editor/common/CustomColorPicker/style.js +0 -53
  101. package/dist/Editor/common/CustomDialog/index.js +0 -94
  102. package/dist/Editor/common/CustomDialog/style.js +0 -67
  103. package/dist/Editor/common/CustomSelect.js +0 -33
  104. package/dist/Editor/hooks/useEditorTheme.js +0 -139
  105. package/dist/Editor/theme/index.js +0 -144
  106. package/dist/Editor/themeSettings/ActiveTheme.js +0 -72
  107. package/dist/Editor/themeSettings/buttons/index.js +0 -290
  108. package/dist/Editor/themeSettings/buttons/style.js +0 -21
  109. package/dist/Editor/themeSettings/colorTheme/index.js +0 -290
  110. package/dist/Editor/themeSettings/colorTheme/style.js +0 -77
  111. package/dist/Editor/themeSettings/fonts/PreviewElement.js +0 -123
  112. package/dist/Editor/themeSettings/fonts/index.js +0 -213
  113. package/dist/Editor/themeSettings/fonts/style.js +0 -44
  114. package/dist/Editor/themeSettings/icons.js +0 -60
  115. package/dist/Editor/themeSettings/index.js +0 -320
  116. package/dist/Editor/themeSettings/style.js +0 -152
  117. package/dist/Editor/themeSettingsAI/icons.js +0 -96
  118. package/dist/Editor/themeSettingsAI/index.js +0 -356
  119. package/dist/Editor/themeSettingsAI/saveTheme.js +0 -190
  120. package/dist/Editor/themeSettingsAI/style.js +0 -247
@@ -27,7 +27,8 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
27
27
  toolBar = true,
28
28
  onSave,
29
29
  onsubmit,
30
- onBlur = () => {}
30
+ onBlur = () => {},
31
+ isMobile = false
31
32
  } = props;
32
33
  const classes = usePopupStyle(theme);
33
34
  const convertedContent = draftToSlate({
@@ -54,6 +55,22 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
54
55
  if (editor) {
55
56
  ReactEditor.focus(editor);
56
57
  insertEmoji(editor, emoji?.native, editor.selection);
58
+ if (editor.selection) {
59
+ // const path = editor.selection.anchor.path;
60
+ // const offset = editor.selection.anchor.offset + emoji?.native.length;
61
+ const position = {
62
+ anchor: {
63
+ path: [0],
64
+ offset: 0
65
+ },
66
+ focus: {
67
+ path: [0],
68
+ offset: 0
69
+ }
70
+ };
71
+ // Create a new selection
72
+ Transforms.select(editor, position);
73
+ }
57
74
  ReactEditor.focus(editor);
58
75
  }
59
76
  },
@@ -110,12 +127,12 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
110
127
  }
111
128
  }
112
129
  }));
113
- useEffect(() => {
114
- setIsExternalUpdate(true);
115
- setValue(draftToSlate({
116
- data: content
117
- }));
118
- }, [content]);
130
+
131
+ // useEffect(() => {
132
+ // setIsExternalUpdate(true);
133
+ // setValue(draftToSlate({ data: content }));
134
+ // }, [content]);
135
+
119
136
  useEffect(() => {
120
137
  if (JSON.stringify(loadedValue) !== JSON.stringify(deboundedValue) && isInteracted && onSave) {
121
138
  const {
@@ -178,14 +195,9 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
178
195
  });
179
196
  };
180
197
  const handleEditorChange = newValue => {
181
- if (isExternalUpdate) {
182
- setIsExternalUpdate(false);
183
- return;
184
- } else {
185
- setValue(newValue);
186
- if (!isInteracted) {
187
- setIsInteracted(true);
188
- }
198
+ setValue(newValue);
199
+ if (!isInteracted) {
200
+ setIsInteracted(true);
189
201
  }
190
202
  };
191
203
  const Element = props => {
@@ -222,7 +234,7 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
222
234
  event,
223
235
  editor
224
236
  });
225
- } else if (event.key === "Enter") {
237
+ } else if (event.key === "Enter" && !isMobile) {
226
238
  const isEmpty = value.length === 1 && value[0].type === 'paragraph' && value[0].children.length === 1 && value[0].children[0].text === '';
227
239
  if (isEmpty) {
228
240
  event.preventDefault();
@@ -269,7 +281,6 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
269
281
  renderLeaf: renderLeaf,
270
282
  placeholder: "Start typing ...",
271
283
  spellCheck: true,
272
- autoFocus: true,
273
284
  onBlur: handleBlur,
274
285
  onKeyDown: onKeyDown
275
286
  }), !readOnly ? /*#__PURE__*/_jsx(MentionsPopup, {
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable no-unused-vars */
2
- import React, { useRef, useCallback, useEffect, useMemo, useState, forwardRef, useImperativeHandle, createContext } from "react";
2
+ import React, { useRef, useCallback, useEffect, useMemo, useState, forwardRef, useImperativeHandle } from "react";
3
3
  import { createEditor, Transforms } from "slate";
4
4
  import { Slate, Editable, ReactEditor } from "slate-react";
5
5
  import { useDebounce, useDebouncedCallback } from "use-debounce";
@@ -18,7 +18,7 @@ import { getThumbnailImage, invertColor } from "./helper";
18
18
  import PopupTool from "./Toolbar/PopupTool";
19
19
  import "./font.css";
20
20
  import "./Editor.css";
21
- import { Box, IconButton, Typography } from "@mui/material";
21
+ import { Box, Button, Typography } from "@mui/material";
22
22
  import Shorthands from "./common/Shorthands";
23
23
  import MiniToolbar from "./Toolbar/Mini/MiniToolbar";
24
24
  import { EditorProvider } from "./hooks/useMouseMove";
@@ -28,19 +28,12 @@ import DragAndDrop from "./common/DnD";
28
28
  import Section from "./common/Section";
29
29
  import "animate.css";
30
30
  import decorators from "./utils/Decorators";
31
- import { getTRBLBreakPoints, getVariableValue } from "./helper/theme";
31
+ import { getTRBLBreakPoints } from "./helper/theme";
32
32
  import { handleInsertLastElement, onDeleteKey, outsideEditorClickLabel } from "./utils/helper";
33
33
  import useWindowResize from "./hooks/useWindowResize";
34
- import { getTheme } from "./theme";
35
- import { useTheme } from "@emotion/react";
36
- import ThemeSettings from "./themeSettings";
37
- import ThemeSettingsAI from "./themeSettingsAI";
38
- import { Experimental_CssVarsProvider as CssVarsProvider, experimental_extendTheme as extendTheme } from "@mui/material/styles";
39
34
  import PopoverAIInput from "./Elements/AI/PopoverAIInput";
40
- import { ThemeAIIcon, ThemePaintIcon } from "./assets/svg/ThemeIcons";
41
35
  import { jsx as _jsx } from "react/jsx-runtime";
42
36
  import { jsxs as _jsxs } from "react/jsx-runtime";
43
- export const ThemeContext = /*#__PURE__*/createContext(null);
44
37
  const Item = /*#__PURE__*/forwardRef(({
45
38
  children,
46
39
  ...props
@@ -67,8 +60,7 @@ const Leaf = ({
67
60
  children,
68
61
  leaf
69
62
  }) => {
70
- const theme = useTheme();
71
- children = getMarked(leaf, children, theme);
63
+ children = getMarked(leaf, children);
72
64
  return /*#__PURE__*/_jsx("span", {
73
65
  ...attributes,
74
66
  children: children
@@ -87,8 +79,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
87
79
  toolbarOptions,
88
80
  otherProps,
89
81
  isIframe,
90
- theme,
91
- showThemeButtons
82
+ theme
92
83
  } = props;
93
84
  const editorWrapper = useRef();
94
85
  const mentionsRef = useRef();
@@ -132,11 +123,10 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
132
123
  const {
133
124
  bannerSpacing,
134
125
  pageBgImage,
135
- pageColor = "",
126
+ pageColor,
136
127
  color: pageTextColor,
137
128
  pageWidth,
138
- maxWidth: pageMaxWidth,
139
- theme: selectedTheme
129
+ maxWidth: pageMaxWidth
140
130
  } = pageSt?.pageProps || {
141
131
  bannerSpacing: {
142
132
  left: 0,
@@ -147,11 +137,9 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
147
137
  };
148
138
  const classes = editorStyles({
149
139
  padHeight: !fullScreen ? otherProps?.padHeight : 20,
150
- placeHolderColor: invertColor(pageColor.startsWith("var") ? getVariableValue(pageColor) : pageColor || "#FFF"),
140
+ placeHolderColor: invertColor(pageColor || "#FFF"),
151
141
  theme
152
142
  });
153
- const [openTheme, setOpenTheme] = useState(false);
154
- const [openAITheme, setOpenAITheme] = useState(false);
155
143
  useEffect(() => {
156
144
  setValue(draftToSlate({
157
145
  data: content
@@ -251,12 +239,6 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
251
239
  redo() {
252
240
  editor?.redo();
253
241
  },
254
- toggleTheme() {
255
- setOpenTheme(!openTheme);
256
- },
257
- toggleAITheme() {
258
- setOpenAITheme(!openAITheme);
259
- },
260
242
  getPageSettings: {
261
243
  background: pageBgImage && pageBgImage !== "none" ? `url(${pageBgImage})` : pageColor || ""
262
244
  }
@@ -404,163 +386,113 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
404
386
  }
405
387
  return style;
406
388
  }, [pageBgImage, pageColor]);
407
- const themeProps = getTheme(selectedTheme);
408
- const handleCursorScroll = container => {
409
- const cursorPosition = window.getSelection()?.getRangeAt(0).getBoundingClientRect();
410
- const containerBottom = container.getBoundingClientRect().bottom;
411
- if (cursorPosition?.bottom > containerBottom - 250) {
412
- container.scrollBy({
413
- top: 200,
414
- behavior: 'smooth'
415
- });
416
- }
417
- };
418
- return /*#__PURE__*/_jsx(ThemeContext.Provider, {
419
- value: {
420
- openTheme,
421
- setOpenTheme
422
- },
423
- children: /*#__PURE__*/_jsx(CssVarsProvider, {
424
- theme: extendTheme(selectedTheme?.theme?.cssVars || {}),
425
- children: /*#__PURE__*/_jsxs(EditorProvider, {
426
- theme: theme,
427
- editor: editor,
428
- children: [showThemeButtons ? /*#__PURE__*/_jsxs("div", {
429
- style: {
430
- display: "flex",
431
- justifyContent: "end",
432
- alignItems: "center",
433
- gap: "8px",
434
- width: "70vw",
435
- margin: "auto"
436
- },
437
- children: [/*#__PURE__*/_jsx(IconButton, {
438
- onClick: () => setOpenTheme(true),
439
- children: /*#__PURE__*/_jsx(ThemePaintIcon, {})
440
- }), /*#__PURE__*/_jsx(IconButton, {
441
- onClick: () => setOpenAITheme(true),
442
- style: {
443
- marginTop: "4px"
444
- },
445
- children: /*#__PURE__*/_jsx(ThemeAIIcon, {})
446
- })]
447
- }) : null, /*#__PURE__*/_jsx(DialogWrapper, {
448
- classes: classes,
449
- ...props,
450
- fullScreen: fullScreen,
451
- footer: footer || "",
452
- children: /*#__PURE__*/_jsx(Box, {
453
- component: "div",
454
- className: `${editorClass || ""} ${isIframe ? "iframe-editor" : ""}`,
455
- sx: classes.root,
456
- style: {
457
- ...dotBg
458
- },
459
- children: /*#__PURE__*/_jsxs(Slate, {
460
- editor: editor,
461
- initialValue: value,
462
- onChange: handleEditorChange,
463
- children: [/*#__PURE__*/_jsx(DragAndDrop, {
464
- children: /*#__PURE__*/_jsxs(Overlay, {
465
- children: [/*#__PURE__*/_jsx(Box, {
466
- className: `${hasTopBanner() ? "has-topbanner" : ""} ${!pageColor ? "no-color" : ""} ${isScrolling ? "" : "hideScroll"} scrollable-content scrollSmooth`,
467
- sx: classes.slateWrapper,
468
- id: "slate-wrapper-scroll-container"
469
- // style={editorWrapperStyle}
470
- ,
471
- ref: editorWrapper,
472
- onClick: e => {
473
- handleInsertLastElement(e, editor);
474
- },
475
- onScroll: handleScroll,
476
- style: editorWrapperStyle,
389
+ return /*#__PURE__*/_jsx(EditorProvider, {
390
+ theme: theme,
391
+ editor: editor,
392
+ children: /*#__PURE__*/_jsx(DialogWrapper, {
393
+ classes: classes,
394
+ ...props,
395
+ fullScreen: fullScreen,
396
+ footer: footer || "",
397
+ children: /*#__PURE__*/_jsx(Box, {
398
+ component: "div",
399
+ className: `${editorClass || ""} ${isIframe ? "iframe-editor" : ""}`,
400
+ sx: classes.root,
401
+ style: {
402
+ ...dotBg
403
+ },
404
+ children: /*#__PURE__*/_jsxs(Slate, {
405
+ editor: editor,
406
+ initialValue: value,
407
+ onChange: handleEditorChange,
408
+ children: [/*#__PURE__*/_jsx(DragAndDrop, {
409
+ children: /*#__PURE__*/_jsxs(Overlay, {
410
+ children: [/*#__PURE__*/_jsx(Box, {
411
+ className: `${hasTopBanner() ? "has-topbanner" : ""} ${!pageColor ? "no-color" : ""} ${isScrolling ? "" : "hideScroll"} scrollable-content scrollSmooth`,
412
+ sx: classes.slateWrapper,
413
+ id: "slate-wrapper-scroll-container"
414
+ // style={editorWrapperStyle}
415
+ ,
416
+ ref: editorWrapper,
417
+ onClick: e => {
418
+ handleInsertLastElement(e, editor);
419
+ },
420
+ onScroll: handleScroll,
421
+ style: editorWrapperStyle,
422
+ children: /*#__PURE__*/_jsxs(Box, {
423
+ component: "div",
424
+ className: "max-content",
425
+ "data-info": outsideEditorClickLabel,
426
+ children: [renderTopBanner(), /*#__PURE__*/_jsx("div", {
427
+ className: "scroll-area",
428
+ "data-info": outsideEditorClickLabel,
477
429
  children: /*#__PURE__*/_jsxs(Box, {
478
430
  component: "div",
479
- className: "max-content",
480
- sx: themeProps?.sxProps || {},
481
- "data-info": outsideEditorClickLabel,
482
- children: [renderTopBanner(), /*#__PURE__*/_jsx("div", {
483
- className: "scroll-area",
484
- "data-info": outsideEditorClickLabel,
485
- children: /*#__PURE__*/_jsxs(Box, {
486
- component: "div",
487
- className: `editor-wrapper ${pageWidth === "fixed" ? "fixed" : "full"}`,
488
- sx: {
489
- backgroundColor: "transparent",
490
- padding: {
491
- ...getTRBLBreakPoints(bannerSpacing)
492
- },
493
- width: !pageWidth || pageWidth === "fixed" ? fixedWidth : fullWidth,
494
- height: viewport.h ? `${viewport.h}px` : `100%`,
495
- alignSelf: "center",
496
- transformOrigin: "left top",
497
- transition: "all 0.3s",
498
- minHeight: "87%",
499
- maxWidth: pageMaxWidth ? `${parseInt(pageMaxWidth)}px !important` : "auto"
500
- },
501
- "data-info": outsideEditorClickLabel,
502
- children: [/*#__PURE__*/_jsx(Editable, {
503
- className: "innert-editor-textbox",
504
- readOnly: isReadOnly,
505
- renderElement: renderElement,
506
- renderLeaf: renderLeaf,
507
- decorate: decorators,
508
- onKeyDown: onKeyDown,
509
- onSelect: () => handleCursorScroll(editorWrapper.current)
510
- }), !readOnly ? /*#__PURE__*/_jsx(MentionsPopup, {
511
- ref: mentionsRef,
512
- mentions: mentions,
513
- setMentions: setMentions,
514
- editor: editor,
515
- target: target,
516
- index: index,
517
- chars: chars,
518
- type: type,
519
- theme: theme
520
- }) : null]
521
- })
522
- }), !hideMiniToolBar ? /*#__PURE__*/_jsx(MiniToolbar, {
523
- customProps: customProps,
524
- toolbarOptions: toolbarOptions,
525
- theme: theme
526
- }) : null, /*#__PURE__*/_jsx(PopoverAIInput, {
527
- otherProps: otherProps || {}
528
- }), footer && (fullScreen || readOnly) && /*#__PURE__*/_jsx(Typography, {
529
- sx: {
530
- color: "rgb(100, 116, 139)",
531
- fontSize: "13px",
532
- paddingBottom: hideMiniToolBar ? "0px" : "12px",
533
- cursor: "pointer"
431
+ className: `editor-wrapper ${pageWidth === "fixed" ? "fixed" : "full"}`,
432
+ sx: {
433
+ backgroundColor: "transparent",
434
+ padding: {
435
+ ...getTRBLBreakPoints(bannerSpacing)
534
436
  },
535
- align: "center",
536
- "data-info": outsideEditorClickLabel,
537
- onClick: handleFooterClick,
538
- children: footer
539
- }), openTheme ? /*#__PURE__*/_jsx(ThemeSettings, {
540
- open: openTheme,
541
- setOpen: setOpenTheme,
437
+ width: !pageWidth || pageWidth === "fixed" ? fixedWidth : fullWidth,
438
+ height: viewport.h ? `${viewport.h}px` : `100%`,
439
+ alignSelf: "center",
440
+ transformOrigin: "left top",
441
+ transition: "all 0.3s",
442
+ minHeight: "87%",
443
+ maxWidth: pageMaxWidth ? `${parseInt(pageMaxWidth)}px !important` : "auto"
444
+ },
445
+ "data-info": outsideEditorClickLabel,
446
+ children: [/*#__PURE__*/_jsx(Editable, {
447
+ className: "innert-editor-textbox",
448
+ readOnly: isReadOnly,
449
+ renderElement: renderElement,
450
+ renderLeaf: renderLeaf,
451
+ decorate: decorators,
452
+ onKeyDown: onKeyDown
453
+ }), !readOnly ? /*#__PURE__*/_jsx(MentionsPopup, {
454
+ ref: mentionsRef,
455
+ mentions: mentions,
456
+ setMentions: setMentions,
542
457
  editor: editor,
543
- services: otherProps?.services
544
- }) : null, /*#__PURE__*/_jsx(ThemeSettingsAI, {
545
- openAITheme: openAITheme,
546
- setOpenAITheme: setOpenAITheme,
547
- onSaveTheme: otherProps?.onSaveTheme
548
- })]
458
+ target: target,
459
+ index: index,
460
+ chars: chars,
461
+ type: type,
462
+ theme: theme
463
+ }) : null]
549
464
  })
550
- }), !readOnly ? /*#__PURE__*/_jsx(PopupTool, {
551
- onDrawerOpen: onDrawerOpen,
552
- theme: theme,
553
- setIsTextSelected: setIsTextSelected,
554
- customProps: customProps
555
- }) : null]
465
+ }), !hideMiniToolBar ? /*#__PURE__*/_jsx(MiniToolbar, {
466
+ customProps: customProps,
467
+ toolbarOptions: toolbarOptions,
468
+ theme: theme
469
+ }) : null, /*#__PURE__*/_jsx(PopoverAIInput, {
470
+ otherProps: otherProps || {}
471
+ }), footer && (fullScreen || readOnly) && /*#__PURE__*/_jsx(Typography, {
472
+ sx: {
473
+ color: "rgb(100, 116, 139)",
474
+ fontSize: "13px",
475
+ paddingBottom: hideMiniToolBar ? "0px" : "12px",
476
+ cursor: "pointer"
477
+ },
478
+ align: "center",
479
+ "data-info": outsideEditorClickLabel,
480
+ onClick: handleFooterClick,
481
+ children: footer
482
+ })]
556
483
  })
557
- }), htmlAction.showInput && /*#__PURE__*/_jsx(CodeToText, {
558
- ...htmlAction,
559
- handleCodeToText: handleCodeToText
560
- })]
561
- }, id)
562
- })
563
- })]
484
+ }), !readOnly ? /*#__PURE__*/_jsx(PopupTool, {
485
+ onDrawerOpen: onDrawerOpen,
486
+ theme: theme,
487
+ setIsTextSelected: setIsTextSelected,
488
+ customProps: customProps
489
+ }) : null]
490
+ })
491
+ }), htmlAction.showInput && /*#__PURE__*/_jsx(CodeToText, {
492
+ ...htmlAction,
493
+ handleCodeToText: handleCodeToText
494
+ })]
495
+ }, id)
564
496
  })
565
497
  })
566
498
  });
@@ -55,6 +55,7 @@ blockquote {
55
55
  }
56
56
 
57
57
  .editor-wrapper {
58
+ background: #ffffff;
58
59
  min-height: 400px;
59
60
  height: fit-content;
60
61
  max-width: 100%;
@@ -244,13 +245,6 @@ blockquote {
244
245
  width: 17px !important;
245
246
  }
246
247
 
247
- .react-datepicker__input-container input {
248
- height: 40px !important;
249
- border: 1px solid #ccc;
250
- border-radius: 5px;
251
- width: 100%;
252
- }
253
-
254
248
  .close-popupbtn {
255
249
  border-radius: 4px !important;
256
250
  width: 24px;
@@ -836,6 +830,17 @@ blockquote {
836
830
  text-align: center;
837
831
  }
838
832
 
833
+ .removeScroll::-webkit-outer-spin-button,
834
+ .removeScroll::-webkit-inner-spin-button {
835
+ -webkit-appearance: none;
836
+ margin: 0;
837
+ }
838
+
839
+ /* For Firefox */
840
+ .removeScroll {
841
+ -moz-appearance: textfield;
842
+ }
843
+
839
844
  .borderInput:focus-visible {
840
845
  outline: none !important;
841
846
  }
@@ -885,7 +890,7 @@ blockquote {
885
890
  }
886
891
 
887
892
  .sliderInput {
888
- width: 66px;
893
+ width: 30px;
889
894
  padding: 2px 10px;
890
895
  margin-left: 18px;
891
896
  box-shadow: 0px 4px 16px 0px #0000000d;
@@ -6,11 +6,11 @@ import Icon from "../../common/Icon";
6
6
  import { IoSend } from "react-icons/io5";
7
7
  import React, { forwardRef, useEffect, useRef } from "react";
8
8
  import WaveLoading from "../../common/WaveLoading";
9
+ import useWindowResize from "../../hooks/useWindowResize";
9
10
  import CustomSelect from "./CustomSelect";
10
11
  import { editContentOptions, newContentOptions, generatedContentOptions } from "./helper";
11
12
  import useClickOutside from "../../hooks/useClickOutside";
12
13
  import { useEditorContext } from "../../hooks/useMouseMove";
13
- import { ChatMicIcon } from "../../assets/svg/AIIcons";
14
14
  import { jsx as _jsx } from "react/jsx-runtime";
15
15
  import { jsxs as _jsxs } from "react/jsx-runtime";
16
16
  import { Fragment as _Fragment } from "react/jsx-runtime";
@@ -18,7 +18,7 @@ function getProps(openAI, generatedText) {
18
18
  const dropDownProps = {
19
19
  fromElements: {
20
20
  options: newContentOptions,
21
- show: generatedText?.length
21
+ show: window.getSelection().toString().length
22
22
  },
23
23
  fromToolBar: {
24
24
  options: editContentOptions,
@@ -36,19 +36,19 @@ function getProps(openAI, generatedText) {
36
36
  }
37
37
  function AIInput({
38
38
  onSend,
39
+ loading,
39
40
  generatedText,
40
41
  openAI,
41
42
  inputValue,
42
43
  onInputChange,
43
- onClickOutside,
44
- startRecording,
45
- loading
44
+ onClickOutside
46
45
  }, ref) {
47
46
  const {
48
47
  theme
49
48
  } = useEditorContext();
50
49
  const classes = Styles(theme);
51
50
  const inputRef = useRef();
51
+ const [size] = useWindowResize();
52
52
  const inputWrapperRef = useRef();
53
53
  const refs = useClickOutside({
54
54
  onClickOutside,
@@ -74,10 +74,22 @@ function AIInput({
74
74
  if (isSendBtnDisabled) {
75
75
  return;
76
76
  }
77
- onSend("", {});
77
+ onSend("", {
78
+ replace: true,
79
+ isSendBtn: true
80
+ });
78
81
  };
79
82
  return /*#__PURE__*/_jsxs(_Fragment, {
80
- children: [/*#__PURE__*/_jsxs(Box, {
83
+ children: [size.device === "xs" ? /*#__PURE__*/_jsx(Box, {
84
+ component: "div",
85
+ ref: refs[1],
86
+ sx: classes.customSelectWrapper,
87
+ children: /*#__PURE__*/_jsx(CustomSelect, {
88
+ ...props,
89
+ onSend: onSend,
90
+ classes: classes
91
+ })
92
+ }) : null, /*#__PURE__*/_jsxs(Box, {
81
93
  component: "div",
82
94
  sx: classes.aiContainer,
83
95
  children: [generatedText ? /*#__PURE__*/_jsx(Typography, {
@@ -89,9 +101,7 @@ function AIInput({
89
101
  fontFamily: "inherit",
90
102
  margin: 0
91
103
  },
92
- dangerouslySetInnerHTML: {
93
- __html: generatedText
94
- }
104
+ children: generatedText
95
105
  })
96
106
  }) : null, /*#__PURE__*/_jsxs(Box, {
97
107
  component: "form",
@@ -122,25 +132,21 @@ function AIInput({
122
132
  handleSendBtnClick();
123
133
  }
124
134
  }
125
- }), fromToolBar ? null : /*#__PURE__*/_jsxs(Box, {
135
+ }), fromToolBar ? null : /*#__PURE__*/_jsx(Box, {
126
136
  component: "div",
127
137
  style: classes.sendIconContainer,
128
138
  className: "icons-elements",
129
- children: [/*#__PURE__*/_jsx(IconButton, {
130
- disabled: loading,
131
- onClick: () => startRecording(),
132
- children: /*#__PURE__*/_jsx(ChatMicIcon, {})
133
- }), /*#__PURE__*/_jsx(IconButton, {
139
+ children: /*#__PURE__*/_jsx(IconButton, {
134
140
  sx: isSendBtnDisabled ? classes.sendBtnDisabled : classes.sendBtn,
135
141
  onClick: () => handleSendBtnClick(),
136
142
  children: /*#__PURE__*/_jsx(IoSend, {
137
143
  color: "#fff",
138
144
  size: 14
139
145
  })
140
- })]
146
+ })
141
147
  })]
142
148
  })]
143
- }), /*#__PURE__*/_jsx(Box, {
149
+ }), size.device === "xs" ? null : /*#__PURE__*/_jsx(Box, {
144
150
  component: "div",
145
151
  ref: refs[1],
146
152
  sx: classes.customSelectWrapper,
@@ -1,4 +1,4 @@
1
- import { Box, Button, IconButton, Popper, Typography } from "@mui/material";
1
+ import { Box, Button, IconButton, Popover, Typography } from "@mui/material";
2
2
  import React, { useRef, useState } from "react";
3
3
  import { FaChevronRight } from "react-icons/fa";
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -49,17 +49,9 @@ function DisplayOption({
49
49
  } = option;
50
50
  const [open, setOpen] = useState(false);
51
51
  const optionRef = useRef();
52
- const openOptions = e => {
53
- if (option.options?.length && !open) {
54
- setOpen(e.currentTarget);
55
- return;
56
- }
57
- };
58
52
  return /*#__PURE__*/_jsxs(Box, {
59
53
  sx: classes.optionWrapper,
60
54
  ref: optionRef,
61
- onMouseEnter: openOptions,
62
- onMouseLeave: () => setOpen(null),
63
55
  children: [/*#__PURE__*/_jsxs(Button, {
64
56
  sx: classes.optionBtn,
65
57
  onClick: e => {
@@ -67,7 +59,7 @@ function DisplayOption({
67
59
 
68
60
  // is having child options
69
61
  if (option.options?.length) {
70
- openOptions(e);
62
+ setOpen(e.currentTarget);
71
63
  return;
72
64
  }
73
65
  setOpen(null);
@@ -85,24 +77,25 @@ function DisplayOption({
85
77
  size: 12
86
78
  })
87
79
  })]
88
- }), /*#__PURE__*/_jsx(Popper, {
80
+ }), /*#__PURE__*/_jsx(Popover, {
89
81
  open: open && option.options,
90
82
  anchorEl: open,
91
83
  sx: {
92
84
  zIndex: 9001,
93
85
  background: "transparent"
94
86
  },
87
+ anchorOrigin: {
88
+ vertical: "top",
89
+ horizontal: "right"
90
+ },
95
91
  onClose: () => {
96
92
  setOpen(null);
97
93
  },
98
- placement: "right-start",
99
- children: /*#__PURE__*/_jsx(Box, {
100
- children: /*#__PURE__*/_jsx(CustomSelect, {
101
- options: option.options,
102
- onSend: onSend,
103
- classes: classes,
104
- show: open
105
- })
94
+ children: /*#__PURE__*/_jsx(CustomSelect, {
95
+ options: option.options,
96
+ onSend: onSend,
97
+ classes: classes,
98
+ show: open
106
99
  })
107
100
  })]
108
101
  });