@flozy/editor 4.0.1 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/dist/Editor/ChatEditor.js +3 -19
  2. package/dist/Editor/CommonEditor.js +181 -109
  3. package/dist/Editor/Editor.css +31 -3
  4. package/dist/Editor/Elements/AI/AIInput.js +31 -33
  5. package/dist/Editor/Elements/AI/CustomSelect.js +19 -12
  6. package/dist/Editor/Elements/AI/PopoverAIInput.js +73 -97
  7. package/dist/Editor/Elements/AI/Styles.js +2 -2
  8. package/dist/Editor/Elements/AI/VoiceToText/AudioWave.js +73 -0
  9. package/dist/Editor/Elements/AI/VoiceToText/index.js +184 -0
  10. package/dist/Editor/Elements/AI/VoiceToText/style.js +40 -0
  11. package/dist/Editor/Elements/AI/helper.js +5 -3
  12. package/dist/Editor/Elements/Accordion/Accordion.js +1 -1
  13. package/dist/Editor/Elements/Accordion/AccordionSummary.js +5 -10
  14. package/dist/Editor/Elements/AppHeader/AppHeader.js +26 -4
  15. package/dist/Editor/Elements/Button/EditorButton.js +28 -16
  16. package/dist/Editor/Elements/Carousel/CarouselButton.js +2 -1
  17. package/dist/Editor/Elements/Color Picker/ColorButtons.js +60 -15
  18. package/dist/Editor/Elements/Color Picker/ColorPicker.css +25 -1
  19. package/dist/Editor/Elements/Color Picker/ColorPicker.js +4 -4
  20. package/dist/Editor/Elements/Color Picker/Styles.js +3 -1
  21. package/dist/Editor/Elements/Emoji/EmojiPicker.js +2 -4
  22. package/dist/Editor/Elements/Form/Workflow/FormWorkflow.js +12 -3
  23. package/dist/Editor/Elements/Form/Workflow/UserInputs.js +2 -1
  24. package/dist/Editor/Elements/Grid/Grid.js +27 -3
  25. package/dist/Editor/Elements/Grid/GridItem.js +3 -1
  26. package/dist/Editor/Elements/Link/Link.js +6 -1
  27. package/dist/Editor/Elements/Link/LinkButton.js +4 -2
  28. package/dist/Editor/Elements/Link/LinkPopup.js +73 -14
  29. package/dist/Editor/Elements/Link/LinkPopupStyles.js +28 -0
  30. package/dist/Editor/Elements/List/CheckList.js +1 -2
  31. package/dist/Editor/Elements/NewLine/NewLineButton.js +2 -1
  32. package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +3 -3
  33. package/dist/Editor/Elements/Redo/RedoButton.js +14 -0
  34. package/dist/Editor/Elements/Signature/Signature.css +13 -6
  35. package/dist/Editor/Elements/Signature/SignatureOptions/UploadSignature.js +2 -1
  36. package/dist/Editor/Elements/Signature/SignaturePopup.js +185 -30
  37. package/dist/Editor/Elements/SimpleText/index.js +11 -1
  38. package/dist/Editor/Elements/SimpleText/style.js +1 -1
  39. package/dist/Editor/Elements/Table/Styles.js +23 -1
  40. package/dist/Editor/Elements/Table/Table.js +2 -1
  41. package/dist/Editor/Elements/Table/TableCell.js +69 -7
  42. package/dist/Editor/Elements/TableContextMenu/TableContextMenu.js +1 -0
  43. package/dist/Editor/Elements/Undo/UndoButton.js +14 -0
  44. package/dist/Editor/MiniEditor.js +3 -1
  45. package/dist/Editor/Styles/EditorStyles.js +1 -1
  46. package/dist/Editor/Toolbar/Basic/index.js +4 -2
  47. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +27 -3
  48. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
  49. package/dist/Editor/Toolbar/FormatTools/TextSize.js +31 -20
  50. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +36 -5
  51. package/dist/Editor/Toolbar/Mini/Options/Options.js +10 -0
  52. package/dist/Editor/Toolbar/Mini/Styles.js +7 -0
  53. package/dist/Editor/Toolbar/PopupTool/ButtonTemplatesCard.js +12 -13
  54. package/dist/Editor/Toolbar/PopupTool/FullViewCard.js +12 -13
  55. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/CustomSelectTool.js +3 -0
  56. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +4 -11
  57. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectSuperSubscript.js +59 -0
  58. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +213 -86
  59. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +4 -2
  60. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +123 -44
  61. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +106 -44
  62. package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +438 -0
  63. package/dist/Editor/Toolbar/PopupTool/index.js +7 -6
  64. package/dist/Editor/Toolbar/toolbarGroups.js +53 -11
  65. package/dist/Editor/assets/svg/AIIcons.js +153 -1
  66. package/dist/Editor/assets/svg/AddTemplateIcon.js +13 -10
  67. package/dist/Editor/assets/svg/RedoIcon.js +27 -0
  68. package/dist/Editor/assets/svg/SettingsIcon.js +28 -0
  69. package/dist/Editor/assets/svg/TextIcon.js +8 -5
  70. package/dist/Editor/assets/svg/ThemeIcons.js +291 -0
  71. package/dist/Editor/assets/svg/UndoIcon.js +27 -0
  72. package/dist/Editor/common/ColorPickerButton.js +26 -18
  73. package/dist/Editor/common/CustomColorPicker/index.js +106 -0
  74. package/dist/Editor/common/CustomColorPicker/style.js +53 -0
  75. package/dist/Editor/common/CustomDialog/index.js +94 -0
  76. package/dist/Editor/common/CustomDialog/style.js +67 -0
  77. package/dist/Editor/common/CustomSelect.js +33 -0
  78. package/dist/Editor/common/DnD/DragHandleButton.js +56 -47
  79. package/dist/Editor/common/EditorIcons.js +7 -7
  80. package/dist/Editor/common/Icon.js +64 -25
  81. package/dist/Editor/common/ImageList.js +16 -3
  82. package/dist/Editor/common/ImageSelector/ImageSelector.js +30 -9
  83. package/dist/Editor/common/ImageSelector/Styles.js +2 -1
  84. package/dist/Editor/common/LinkSettings/NavComponents.js +5 -2
  85. package/dist/Editor/common/LinkSettings/index.js +4 -2
  86. package/dist/Editor/common/LinkSettings/navOptions.js +7 -2
  87. package/dist/Editor/common/LinkSettings/style.js +11 -8
  88. package/dist/Editor/common/MentionsPopup/Styles.js +1 -1
  89. package/dist/Editor/common/Section/index.js +57 -7
  90. package/dist/Editor/common/Section/styles.js +11 -0
  91. package/dist/Editor/common/Shorthands/elements.js +63 -9
  92. package/dist/Editor/common/StyleBuilder/accordionTitleBtnStyle.js +1 -2
  93. package/dist/Editor/common/StyleBuilder/buttonStyle.js +4 -2
  94. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +13 -3
  95. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +15 -7
  96. package/dist/Editor/common/StyleBuilder/fieldTypes/buttonLink.js +1 -1
  97. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +29 -7
  98. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +13 -4
  99. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +14 -4
  100. package/dist/Editor/common/StyleBuilder/index.js +1 -1
  101. package/dist/Editor/common/iconListV2.js +843 -0
  102. package/dist/Editor/common/iconslist.js +0 -31
  103. package/dist/Editor/commonStyle.js +6 -0
  104. package/dist/Editor/helper/index.js +0 -22
  105. package/dist/Editor/helper/theme.js +189 -3
  106. package/dist/Editor/hooks/useEditorTheme.js +139 -0
  107. package/dist/Editor/hooks/useMouseMove.js +4 -1
  108. package/dist/Editor/hooks/useWindowMessage.js +10 -7
  109. package/dist/Editor/plugins/withEmbeds.js +1 -1
  110. package/dist/Editor/plugins/withHTML.js +1 -1
  111. package/dist/Editor/plugins/withTable.js +1 -1
  112. package/dist/Editor/theme/ThemeList.js +50 -173
  113. package/dist/Editor/theme/index.js +144 -0
  114. package/dist/Editor/themeSettings/ActiveTheme.js +72 -0
  115. package/dist/Editor/themeSettings/buttons/index.js +290 -0
  116. package/dist/Editor/themeSettings/buttons/style.js +21 -0
  117. package/dist/Editor/themeSettings/colorTheme/index.js +290 -0
  118. package/dist/Editor/themeSettings/colorTheme/style.js +77 -0
  119. package/dist/Editor/themeSettings/fonts/PreviewElement.js +123 -0
  120. package/dist/Editor/themeSettings/fonts/index.js +213 -0
  121. package/dist/Editor/themeSettings/fonts/style.js +44 -0
  122. package/dist/Editor/themeSettings/icons.js +60 -0
  123. package/dist/Editor/themeSettings/index.js +320 -0
  124. package/dist/Editor/themeSettings/style.js +152 -0
  125. package/dist/Editor/themeSettingsAI/icons.js +96 -0
  126. package/dist/Editor/themeSettingsAI/index.js +356 -0
  127. package/dist/Editor/themeSettingsAI/saveTheme.js +190 -0
  128. package/dist/Editor/themeSettingsAI/style.js +247 -0
  129. package/dist/Editor/utils/SlateUtilityFunctions.js +169 -27
  130. package/dist/Editor/utils/button.js +1 -17
  131. package/dist/Editor/utils/events.js +54 -2
  132. package/dist/Editor/utils/font.js +40 -37
  133. package/dist/Editor/utils/helper.js +31 -2
  134. package/dist/Editor/utils/table.js +51 -43
  135. package/package.json +4 -3
@@ -27,8 +27,7 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
27
27
  toolBar = true,
28
28
  onSave,
29
29
  onsubmit,
30
- onBlur = () => {},
31
- isMobile = false
30
+ onBlur = () => {}
32
31
  } = props;
33
32
  const classes = usePopupStyle(theme);
34
33
  const convertedContent = draftToSlate({
@@ -55,22 +54,6 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
55
54
  if (editor) {
56
55
  ReactEditor.focus(editor);
57
56
  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
- }
74
57
  ReactEditor.focus(editor);
75
58
  }
76
59
  },
@@ -234,7 +217,7 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
234
217
  event,
235
218
  editor
236
219
  });
237
- } else if (event.key === "Enter" && !isMobile) {
220
+ } else if (event.key === "Enter") {
238
221
  const isEmpty = value.length === 1 && value[0].type === 'paragraph' && value[0].children.length === 1 && value[0].children[0].text === '';
239
222
  if (isEmpty) {
240
223
  event.preventDefault();
@@ -281,6 +264,7 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
281
264
  renderLeaf: renderLeaf,
282
265
  placeholder: "Start typing ...",
283
266
  spellCheck: true,
267
+ autoFocus: true,
284
268
  onBlur: handleBlur,
285
269
  onKeyDown: onKeyDown
286
270
  }), !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 } from "react";
2
+ import React, { useRef, useCallback, useEffect, useMemo, useState, forwardRef, useImperativeHandle, createContext } 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, Button, Typography } from "@mui/material";
21
+ import { Box, IconButton, 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,12 +28,19 @@ 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 } from "./helper/theme";
31
+ import { getTRBLBreakPoints, getVariableValue } 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";
34
39
  import PopoverAIInput from "./Elements/AI/PopoverAIInput";
40
+ import { ThemeAIIcon, ThemePaintIcon } from "./assets/svg/ThemeIcons";
35
41
  import { jsx as _jsx } from "react/jsx-runtime";
36
42
  import { jsxs as _jsxs } from "react/jsx-runtime";
43
+ export const ThemeContext = /*#__PURE__*/createContext(null);
37
44
  const Item = /*#__PURE__*/forwardRef(({
38
45
  children,
39
46
  ...props
@@ -60,7 +67,8 @@ const Leaf = ({
60
67
  children,
61
68
  leaf
62
69
  }) => {
63
- children = getMarked(leaf, children);
70
+ const theme = useTheme();
71
+ children = getMarked(leaf, children, theme);
64
72
  return /*#__PURE__*/_jsx("span", {
65
73
  ...attributes,
66
74
  children: children
@@ -79,7 +87,8 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
79
87
  toolbarOptions,
80
88
  otherProps,
81
89
  isIframe,
82
- theme
90
+ theme,
91
+ showThemeButtons
83
92
  } = props;
84
93
  const editorWrapper = useRef();
85
94
  const mentionsRef = useRef();
@@ -123,10 +132,11 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
123
132
  const {
124
133
  bannerSpacing,
125
134
  pageBgImage,
126
- pageColor,
135
+ pageColor = "",
127
136
  color: pageTextColor,
128
137
  pageWidth,
129
- maxWidth: pageMaxWidth
138
+ maxWidth: pageMaxWidth,
139
+ theme: selectedTheme
130
140
  } = pageSt?.pageProps || {
131
141
  bannerSpacing: {
132
142
  left: 0,
@@ -137,9 +147,11 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
137
147
  };
138
148
  const classes = editorStyles({
139
149
  padHeight: !fullScreen ? otherProps?.padHeight : 20,
140
- placeHolderColor: invertColor(pageColor || "#FFF"),
150
+ placeHolderColor: invertColor(pageColor.startsWith("var") ? getVariableValue(pageColor) : pageColor || "#FFF"),
141
151
  theme
142
152
  });
153
+ const [openTheme, setOpenTheme] = useState(false);
154
+ const [openAITheme, setOpenAITheme] = useState(false);
143
155
  useEffect(() => {
144
156
  setValue(draftToSlate({
145
157
  data: content
@@ -239,6 +251,12 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
239
251
  redo() {
240
252
  editor?.redo();
241
253
  },
254
+ toggleTheme() {
255
+ setOpenTheme(!openTheme);
256
+ },
257
+ toggleAITheme() {
258
+ setOpenAITheme(!openAITheme);
259
+ },
242
260
  getPageSettings: {
243
261
  background: pageBgImage && pageBgImage !== "none" ? `url(${pageBgImage})` : pageColor || ""
244
262
  }
@@ -386,113 +404,167 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
386
404
  }
387
405
  return style;
388
406
  }, [pageBgImage, pageColor]);
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,
407
+ const themeProps = getTheme(selectedTheme);
408
+ const handleCursorScroll = container => {
409
+ try {
410
+ const cursorPosition = window.getSelection()?.getRangeAt(0).getBoundingClientRect();
411
+ const containerBottom = container.getBoundingClientRect().bottom;
412
+ if (cursorPosition?.bottom > containerBottom - 250) {
413
+ container.scrollBy({
414
+ top: 200,
415
+ behavior: "smooth"
416
+ });
417
+ }
418
+ } catch (err) {
419
+ console.log(err);
420
+ }
421
+ };
422
+ return /*#__PURE__*/_jsx(ThemeContext.Provider, {
423
+ value: {
424
+ openTheme,
425
+ setOpenTheme
426
+ },
427
+ children: /*#__PURE__*/_jsx(CssVarsProvider, {
428
+ theme: extendTheme(selectedTheme?.theme?.cssVars || {}),
429
+ children: /*#__PURE__*/_jsxs(EditorProvider, {
430
+ theme: theme,
431
+ editor: editor,
432
+ children: [showThemeButtons ? /*#__PURE__*/_jsxs("div", {
433
+ style: {
434
+ display: "flex",
435
+ justifyContent: "end",
436
+ alignItems: "center",
437
+ gap: "8px",
438
+ width: "70vw",
439
+ margin: "auto"
440
+ },
441
+ children: [/*#__PURE__*/_jsx(IconButton, {
442
+ onClick: () => setOpenTheme(true),
443
+ children: /*#__PURE__*/_jsx(ThemePaintIcon, {})
444
+ }), /*#__PURE__*/_jsx(IconButton, {
445
+ onClick: () => setOpenAITheme(true),
446
+ style: {
447
+ marginTop: "4px"
448
+ },
449
+ children: /*#__PURE__*/_jsx(ThemeAIIcon, {})
450
+ })]
451
+ }) : null, /*#__PURE__*/_jsx(DialogWrapper, {
452
+ classes: classes,
453
+ ...props,
454
+ fullScreen: fullScreen,
455
+ footer: footer || "",
456
+ children: /*#__PURE__*/_jsx(Box, {
457
+ component: "div",
458
+ className: `${editorClass || ""} ${isIframe ? "iframe-editor" : ""}`,
459
+ sx: classes.root,
460
+ style: {
461
+ ...dotBg
462
+ },
463
+ children: /*#__PURE__*/_jsxs(Slate, {
464
+ editor: editor,
465
+ initialValue: value,
466
+ onChange: handleEditorChange,
467
+ children: [/*#__PURE__*/_jsx(DragAndDrop, {
468
+ children: /*#__PURE__*/_jsxs(Overlay, {
469
+ children: [/*#__PURE__*/_jsx(Box, {
470
+ className: `${hasTopBanner() ? "has-topbanner" : ""} ${!pageColor ? "no-color" : ""} ${isScrolling ? "" : "hideScroll"} scrollable-content scrollSmooth`,
471
+ sx: classes.slateWrapper,
472
+ id: "slate-wrapper-scroll-container"
473
+ // style={editorWrapperStyle}
474
+ ,
475
+ ref: editorWrapper,
476
+ onClick: e => {
477
+ handleInsertLastElement(e, editor);
478
+ },
479
+ onScroll: handleScroll,
480
+ style: editorWrapperStyle,
429
481
  children: /*#__PURE__*/_jsxs(Box, {
430
482
  component: "div",
431
- className: `editor-wrapper ${pageWidth === "fixed" ? "fixed" : "full"}`,
432
- sx: {
433
- backgroundColor: "transparent",
434
- padding: {
435
- ...getTRBLBreakPoints(bannerSpacing)
436
- },
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
- },
483
+ className: "max-content",
484
+ sx: themeProps?.sxProps || {},
445
485
  "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,
457
- editor: editor,
458
- target: target,
459
- index: index,
460
- chars: chars,
461
- type: type,
486
+ children: [renderTopBanner(), /*#__PURE__*/_jsx("div", {
487
+ className: "scroll-area",
488
+ "data-info": outsideEditorClickLabel,
489
+ children: /*#__PURE__*/_jsxs(Box, {
490
+ component: "div",
491
+ className: `editor-wrapper ${pageWidth === "fixed" ? "fixed" : "full"}`,
492
+ sx: {
493
+ backgroundColor: "transparent",
494
+ padding: {
495
+ ...getTRBLBreakPoints(bannerSpacing)
496
+ },
497
+ width: !pageWidth || pageWidth === "fixed" ? fixedWidth : fullWidth,
498
+ height: viewport.h ? `${viewport.h}px` : `100%`,
499
+ alignSelf: "center",
500
+ transformOrigin: "left top",
501
+ transition: "all 0.3s",
502
+ minHeight: "87%",
503
+ maxWidth: pageMaxWidth ? `${parseInt(pageMaxWidth)}px !important` : "auto"
504
+ },
505
+ "data-info": outsideEditorClickLabel,
506
+ children: [/*#__PURE__*/_jsx(Editable, {
507
+ className: "innert-editor-textbox",
508
+ readOnly: isReadOnly,
509
+ renderElement: renderElement,
510
+ renderLeaf: renderLeaf,
511
+ decorate: decorators,
512
+ onKeyDown: onKeyDown,
513
+ onSelect: () => handleCursorScroll(editorWrapper.current)
514
+ }), !readOnly ? /*#__PURE__*/_jsx(MentionsPopup, {
515
+ ref: mentionsRef,
516
+ mentions: mentions,
517
+ setMentions: setMentions,
518
+ editor: editor,
519
+ target: target,
520
+ index: index,
521
+ chars: chars,
522
+ type: type,
523
+ theme: theme
524
+ }) : null]
525
+ })
526
+ }), !hideMiniToolBar ? /*#__PURE__*/_jsx(MiniToolbar, {
527
+ customProps: customProps,
528
+ toolbarOptions: toolbarOptions,
462
529
  theme: theme
463
- }) : null]
530
+ }) : null, /*#__PURE__*/_jsx(PopoverAIInput, {
531
+ otherProps: otherProps || {}
532
+ }), footer && (fullScreen || readOnly) && /*#__PURE__*/_jsx(Typography, {
533
+ sx: {
534
+ color: "rgb(100, 116, 139)",
535
+ fontSize: "13px",
536
+ paddingBottom: hideMiniToolBar ? "0px" : "12px",
537
+ cursor: "pointer"
538
+ },
539
+ align: "center",
540
+ "data-info": outsideEditorClickLabel,
541
+ onClick: handleFooterClick,
542
+ children: footer
543
+ }), openTheme ? /*#__PURE__*/_jsx(ThemeSettings, {
544
+ open: openTheme,
545
+ setOpen: setOpenTheme,
546
+ editor: editor,
547
+ services: otherProps?.services
548
+ }) : null, /*#__PURE__*/_jsx(ThemeSettingsAI, {
549
+ openAITheme: openAITheme,
550
+ setOpenAITheme: setOpenAITheme,
551
+ onSaveTheme: otherProps?.onSaveTheme
552
+ })]
464
553
  })
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
- })]
554
+ }), !readOnly ? /*#__PURE__*/_jsx(PopupTool, {
555
+ onDrawerOpen: onDrawerOpen,
556
+ theme: theme,
557
+ setIsTextSelected: setIsTextSelected,
558
+ customProps: customProps
559
+ }) : null]
483
560
  })
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)
561
+ }), htmlAction.showInput && /*#__PURE__*/_jsx(CodeToText, {
562
+ ...htmlAction,
563
+ handleCodeToText: handleCodeToText
564
+ })]
565
+ }, id)
566
+ })
567
+ })]
496
568
  })
497
569
  })
498
570
  });
@@ -55,7 +55,6 @@ blockquote {
55
55
  }
56
56
 
57
57
  .editor-wrapper {
58
- background: #ffffff;
59
58
  min-height: 400px;
60
59
  height: fit-content;
61
60
  max-width: 100%;
@@ -245,6 +244,13 @@ blockquote {
245
244
  width: 17px !important;
246
245
  }
247
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
+
248
254
  .close-popupbtn {
249
255
  border-radius: 4px !important;
250
256
  width: 24px;
@@ -268,7 +274,7 @@ blockquote {
268
274
  margin: 12px 0px;
269
275
  padding: 0px 5px;
270
276
  border: 0px solid #ccc;
271
- min-height: 100px;
277
+ min-height: 211px;
272
278
  }
273
279
 
274
280
  .signature-signed-wrapper {
@@ -332,7 +338,7 @@ blockquote {
332
338
  .signature-canvas {
333
339
  height: 100%;
334
340
  width: 100%;
335
- border: 1px solid #0052cc;
341
+ border: 1px solid #2563EB;
336
342
  border-radius: 12px;
337
343
  }
338
344
 
@@ -365,6 +371,7 @@ blockquote {
365
371
 
366
372
  .dialog-actions-si .MuiButtonBase-root {
367
373
  opacity: 1;
374
+ padding: 6px 5px 0px 3px !important
368
375
  }
369
376
 
370
377
  .signature-tab {
@@ -375,6 +382,19 @@ blockquote {
375
382
  width: 100%;
376
383
  }
377
384
 
385
+ .signature-tab2 {
386
+ /* display: flex; */
387
+ align-items: center;
388
+ border-width: 0px, 0px, 0px, 0px;
389
+ border-style: solid;
390
+ border-color: #2563EB;
391
+ justify-content: center;
392
+ flex-direction: column;
393
+ width: 100%;
394
+ border-radius: 7px;
395
+ padding: 10px;
396
+ }
397
+
378
398
  .upload-sign-img-wrapper {
379
399
  text-align: center;
380
400
  }
@@ -440,6 +460,10 @@ blockquote {
440
460
  color: #ffffff !important;
441
461
  border: 1px solid #2563eb !important;
442
462
  width: auto !important;
463
+ padding: 2px 0px 0px 0px !important;
464
+ min-width: 89px !important;
465
+ font-family: Inter, sans-serif;
466
+ text-transform: none;
443
467
  }
444
468
 
445
469
  .MuiButton-root.primaryBtn.disabled,
@@ -460,6 +484,10 @@ blockquote {
460
484
  margin-right: 15px !important;
461
485
  color: #2563eb;
462
486
  width: auto !important;
487
+ padding: 2px 0px 0px 0px !important;
488
+ min-width: 89px !important;
489
+ font-family: Inter, sans-serif;
490
+ text-transform: none;
463
491
  }
464
492
 
465
493
  .deleteBtn {
@@ -4,13 +4,13 @@ import Icon from "../../common/Icon";
4
4
  // import { TbRotateClockwise } from "react-icons/tb";
5
5
  // import { FaRegCircleCheck } from "react-icons/fa6";
6
6
  import { IoSend } from "react-icons/io5";
7
- import React, { forwardRef, useEffect, useRef } from "react";
7
+ import React, { forwardRef, useEffect, useRef, useState } from "react";
8
8
  import WaveLoading from "../../common/WaveLoading";
9
- import useWindowResize from "../../hooks/useWindowResize";
10
9
  import CustomSelect from "./CustomSelect";
11
10
  import { editContentOptions, newContentOptions, generatedContentOptions } from "./helper";
12
11
  import useClickOutside from "../../hooks/useClickOutside";
13
12
  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: window.getSelection().toString().length
21
+ show: generatedText?.length
22
22
  },
23
23
  fromToolBar: {
24
24
  options: editContentOptions,
@@ -36,20 +36,21 @@ function getProps(openAI, generatedText) {
36
36
  }
37
37
  function AIInput({
38
38
  onSend,
39
- loading,
40
39
  generatedText,
41
40
  openAI,
42
41
  inputValue,
43
42
  onInputChange,
44
- onClickOutside
43
+ onClickOutside,
44
+ startRecording,
45
+ loading
45
46
  }, ref) {
46
47
  const {
47
48
  theme
48
49
  } = useEditorContext();
49
50
  const classes = Styles(theme);
50
51
  const inputRef = useRef();
51
- const [size] = useWindowResize();
52
52
  const inputWrapperRef = useRef();
53
+ const [contentHeight, setContentHeight] = useState("100px");
53
54
  const refs = useClickOutside({
54
55
  onClickOutside,
55
56
  omitIds: ["infinity-select-popover"],
@@ -74,35 +75,28 @@ function AIInput({
74
75
  if (isSendBtnDisabled) {
75
76
  return;
76
77
  }
77
- onSend("", {
78
- replace: true,
79
- isSendBtn: true
80
- });
78
+ onSend("", {});
81
79
  };
80
+ useEffect(() => {
81
+ const selectWrapper = refs?.length ? refs[1]?.current : null;
82
+ const slateWrapper = document.getElementById("slate-wrapper-scroll-container");
83
+ if (selectWrapper && slateWrapper) {
84
+ const height = slateWrapper.offsetHeight - selectWrapper.offsetHeight - 80;
85
+ setContentHeight(height + "px");
86
+ }
87
+ }, [refs, generatedText]);
82
88
  return /*#__PURE__*/_jsxs(_Fragment, {
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, {
89
+ children: [/*#__PURE__*/_jsxs(Box, {
93
90
  component: "div",
94
91
  sx: classes.aiContainer,
95
92
  children: [generatedText ? /*#__PURE__*/_jsx(Typography, {
96
93
  sx: classes.generatedText,
97
- children: /*#__PURE__*/_jsx("pre", {
98
- style: {
99
- whiteSpace: "pre-wrap",
100
- wordWrap: "break-word",
101
- fontFamily: "inherit",
102
- margin: 0
103
- },
104
- children: generatedText
105
- })
94
+ style: {
95
+ maxHeight: contentHeight
96
+ },
97
+ dangerouslySetInnerHTML: {
98
+ __html: generatedText
99
+ }
106
100
  }) : null, /*#__PURE__*/_jsxs(Box, {
107
101
  component: "form",
108
102
  sx: classes.aiInputWrapper,
@@ -132,21 +126,25 @@ function AIInput({
132
126
  handleSendBtnClick();
133
127
  }
134
128
  }
135
- }), fromToolBar ? null : /*#__PURE__*/_jsx(Box, {
129
+ }), fromToolBar ? null : /*#__PURE__*/_jsxs(Box, {
136
130
  component: "div",
137
131
  style: classes.sendIconContainer,
138
132
  className: "icons-elements",
139
- children: /*#__PURE__*/_jsx(IconButton, {
133
+ children: [/*#__PURE__*/_jsx(IconButton, {
134
+ disabled: loading,
135
+ onClick: () => startRecording(),
136
+ children: /*#__PURE__*/_jsx(ChatMicIcon, {})
137
+ }), /*#__PURE__*/_jsx(IconButton, {
140
138
  sx: isSendBtnDisabled ? classes.sendBtnDisabled : classes.sendBtn,
141
139
  onClick: () => handleSendBtnClick(),
142
140
  children: /*#__PURE__*/_jsx(IoSend, {
143
141
  color: "#fff",
144
142
  size: 14
145
143
  })
146
- })
144
+ })]
147
145
  })]
148
146
  })]
149
- }), size.device === "xs" ? null : /*#__PURE__*/_jsx(Box, {
147
+ }), /*#__PURE__*/_jsx(Box, {
150
148
  component: "div",
151
149
  ref: refs[1],
152
150
  sx: classes.customSelectWrapper,