@flozy/editor 10.4.4 → 10.4.6

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 (165) hide show
  1. package/dist/Editor/ChatEditor.js +17 -16
  2. package/dist/Editor/CommonEditor.js +131 -16
  3. package/dist/Editor/DialogWrapper.js +31 -25
  4. package/dist/Editor/Editor.css +46 -8
  5. package/dist/Editor/Elements/AI/PopoverAIInput.js +11 -3
  6. package/dist/Editor/Elements/Accordion/Accordion.js +46 -9
  7. package/dist/Editor/Elements/Accordion/AccordionSummary.js +1 -23
  8. package/dist/Editor/Elements/AppHeader/AppHeader.js +10 -5
  9. package/dist/Editor/Elements/Button/EditorButton.js +27 -9
  10. package/dist/Editor/Elements/Carousel/CarouselItem.js +2 -1
  11. package/dist/Editor/Elements/Color Picker/ColorButtons.js +61 -14
  12. package/dist/Editor/Elements/Color Picker/ColorPicker.css +25 -1
  13. package/dist/Editor/Elements/Color Picker/ColorPicker.js +10 -7
  14. package/dist/Editor/Elements/Color Picker/Styles.js +15 -13
  15. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/MultiSelect.js +27 -26
  16. package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +5 -5
  17. package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +10 -4
  18. package/dist/Editor/Elements/Embed/Video.js +1 -1
  19. package/dist/Editor/Elements/Form/Form.js +3 -3
  20. package/dist/Editor/Elements/Form/FormElements/FormTextArea.js +0 -1
  21. package/dist/Editor/Elements/Form/FormField.js +3 -2
  22. package/dist/Editor/Elements/Form/Workflow/Styles.js +24 -22
  23. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +35 -31
  24. package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +7 -4
  25. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +1 -0
  26. package/dist/Editor/Elements/FreeGrid/Options/More.js +7 -7
  27. package/dist/Editor/Elements/FreeGrid/Options/sectionItemOptions.js +1 -1
  28. package/dist/Editor/Elements/FreeGrid/helper.js +115 -0
  29. package/dist/Editor/Elements/FreeGrid/styles.js +14 -0
  30. package/dist/Editor/Elements/Grid/Grid.js +14 -2
  31. package/dist/Editor/Elements/Grid/GridItem.js +1 -1
  32. package/dist/Editor/Elements/Signature/Signature.css +2 -1
  33. package/dist/Editor/Elements/Signature/SignatureOptions/DrawSignature.js +18 -5
  34. package/dist/Editor/Elements/Signature/SignatureOptions/UploadSignature.js +16 -3
  35. package/dist/Editor/Elements/SimpleText/style.js +2 -2
  36. package/dist/Editor/Elements/Table/DragButton.js +0 -1
  37. package/dist/Editor/Elements/Table/Draggable.js +6 -2
  38. package/dist/Editor/Elements/Table/Styles.js +7 -0
  39. package/dist/Editor/Elements/Table/Table.js +3 -3
  40. package/dist/Editor/Elements/Table/TableCell.js +24 -5
  41. package/dist/Editor/Elements/Title/title.js +6 -6
  42. package/dist/Editor/Elements/Variables/VariableButton.js +10 -1
  43. package/dist/Editor/MiniEditor.js +2 -1
  44. package/dist/Editor/Styles/EditorStyles.js +5 -5
  45. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +27 -3
  46. package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +4 -3
  47. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
  48. package/dist/Editor/Toolbar/FormatTools/TextSize.js +10 -13
  49. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +2 -1
  50. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/MiniColorPicker.js +4 -2
  51. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +6 -13
  52. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +167 -42
  53. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +7 -4
  54. package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +2 -1
  55. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +72 -12
  56. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +58 -10
  57. package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +439 -0
  58. package/dist/Editor/Toolbar/PopupTool/index.js +1 -1
  59. package/dist/Editor/Toolbar/toolbarGroups.js +48 -6
  60. package/dist/Editor/assets/svg/BackIcon.js +18 -0
  61. package/dist/Editor/assets/svg/ThemeIcons.js +293 -0
  62. package/dist/Editor/common/Checkbox/index.js +46 -0
  63. package/dist/Editor/common/Checkbox/styles.js +45 -0
  64. package/dist/Editor/common/ColorPickerButton.js +41 -16
  65. package/dist/Editor/common/CustomColorPicker/index.js +130 -0
  66. package/dist/Editor/common/CustomColorPicker/style.js +53 -0
  67. package/dist/Editor/common/CustomDialog2/index.js +94 -0
  68. package/dist/Editor/common/CustomDialog2/style.js +67 -0
  69. package/dist/Editor/common/CustomSelect.js +43 -0
  70. package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
  71. package/dist/Editor/common/FontLoader/FontLoader.js +3 -0
  72. package/dist/Editor/common/Icon.js +28 -0
  73. package/dist/Editor/common/ImageSelector/ImageSelector.js +2 -2
  74. package/dist/Editor/common/ImageSelector/Styles.js +3 -9
  75. package/dist/Editor/common/LinkSettings/NavComponents.js +45 -65
  76. package/dist/Editor/common/LinkSettings/index.js +14 -28
  77. package/dist/Editor/common/LinkSettings/navOptions.js +2 -2
  78. package/dist/Editor/common/LinkSettings/style.js +164 -244
  79. package/dist/Editor/common/MentionsPopup/index.js +4 -1
  80. package/dist/Editor/common/RadioGroup/index.js +48 -0
  81. package/dist/Editor/common/RadioGroup/styles.js +29 -0
  82. package/dist/Editor/common/RnD/ElementOptions/Actions.js +4 -5
  83. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +2 -1
  84. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Signature.js +4 -3
  85. package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +3 -2
  86. package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +3 -2
  87. package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +3 -2
  88. package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +3 -2
  89. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +4 -2
  90. package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +3 -2
  91. package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +3 -2
  92. package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +3 -1
  93. package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +3 -2
  94. package/dist/Editor/common/RnD/ElementSettings/styles.js +0 -1
  95. package/dist/Editor/common/RnD/OptionsPopup/style.js +0 -1
  96. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +11 -2
  97. package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +17 -0
  98. package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +6 -3
  99. package/dist/Editor/common/RnD/Utils/gridDropItem.js +28 -19
  100. package/dist/Editor/common/RnD/Utils/index.js +3 -1
  101. package/dist/Editor/common/RnD/VirtualElement/VirtualTextElement.js +42 -58
  102. package/dist/Editor/common/RnD/VirtualElement/helper.js +323 -132
  103. package/dist/Editor/common/RnD/VirtualElement/styles.js +16 -0
  104. package/dist/Editor/common/RnD/index.js +67 -38
  105. package/dist/Editor/common/Select/index.js +44 -7
  106. package/dist/Editor/common/Select/styles.js +30 -2
  107. package/dist/Editor/common/Shorthands/elements.js +54 -0
  108. package/dist/Editor/common/StyleBuilder/accordionTitleBtnStyle.js +2 -2
  109. package/dist/Editor/common/StyleBuilder/accordionTitleStyle.js +12 -9
  110. package/dist/Editor/common/StyleBuilder/buttonStyle.js +4 -2
  111. package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +4 -0
  112. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +5 -0
  113. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +12 -2
  114. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +15 -7
  115. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +16 -8
  116. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +36 -10
  117. package/dist/Editor/common/StyleBuilder/fieldTypes/embedUpload.js +115 -0
  118. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +16 -7
  119. package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +3 -1
  120. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +15 -7
  121. package/dist/Editor/common/SwipeableDrawer/style.js +14 -12
  122. package/dist/Editor/common/Uploader.js +16 -0
  123. package/dist/Editor/common/iconListV2.js +76 -0
  124. package/dist/Editor/common/iconslist.js +21 -0
  125. package/dist/Editor/commonStyle.js +116 -61
  126. package/dist/Editor/helper/index.js +5 -1
  127. package/dist/Editor/helper/textIndeces.js +58 -0
  128. package/dist/Editor/helper/theme.js +203 -2
  129. package/dist/Editor/hooks/useEditorTheme.js +153 -0
  130. package/dist/Editor/hooks/useMouseMove.js +9 -3
  131. package/dist/Editor/hooks/useTable.js +5 -4
  132. package/dist/Editor/hooks/useThemeValues.js +63 -0
  133. package/dist/Editor/plugins/withEmbeds.js +1 -1
  134. package/dist/Editor/plugins/withHTML.js +3 -1
  135. package/dist/Editor/plugins/withTable.js +1 -1
  136. package/dist/Editor/theme/ThemeList.js +50 -173
  137. package/dist/Editor/theme/index.js +149 -0
  138. package/dist/Editor/themeSettings/ActiveTheme.js +82 -0
  139. package/dist/Editor/themeSettings/buttons/index.js +300 -0
  140. package/dist/Editor/themeSettings/buttons/style.js +23 -0
  141. package/dist/Editor/themeSettings/colorTheme/index.js +310 -0
  142. package/dist/Editor/themeSettings/colorTheme/style.js +81 -0
  143. package/dist/Editor/themeSettings/fonts/PreviewElement.js +121 -0
  144. package/dist/Editor/themeSettings/fonts/index.js +240 -0
  145. package/dist/Editor/themeSettings/fonts/style.js +62 -0
  146. package/dist/Editor/themeSettings/icons.js +60 -0
  147. package/dist/Editor/themeSettings/index.js +380 -0
  148. package/dist/Editor/themeSettings/style.js +299 -0
  149. package/dist/Editor/themeSettingsAI/icons.js +96 -0
  150. package/dist/Editor/themeSettingsAI/index.js +355 -0
  151. package/dist/Editor/themeSettingsAI/saveTheme.js +202 -0
  152. package/dist/Editor/themeSettingsAI/style.js +332 -0
  153. package/dist/Editor/utils/SlateUtilityFunctions.js +161 -37
  154. package/dist/Editor/utils/accordion.js +14 -4
  155. package/dist/Editor/utils/button.js +1 -17
  156. package/dist/Editor/utils/customHooks/useTableResize.js +49 -9
  157. package/dist/Editor/utils/draftToSlate.js +3 -2
  158. package/dist/Editor/utils/events.js +50 -6
  159. package/dist/Editor/utils/font.js +40 -37
  160. package/dist/Editor/utils/formfield.js +1 -0
  161. package/dist/Editor/utils/helper.js +210 -26
  162. package/dist/Editor/utils/insertAppHeader.js +1 -1
  163. package/dist/Editor/utils/signature.js +2 -9
  164. package/dist/Editor/utils/updateFormName.js +22 -0
  165. package/package.json +4 -4
@@ -1,6 +1,6 @@
1
1
  import React, { useCallback, useMemo, useRef, useImperativeHandle, forwardRef, useState } from "react";
2
- import { Editable, Slate, ReactEditor } from 'slate-react';
3
- import { createEditor, Transforms, Editor } from 'slate';
2
+ import { Editable, Slate, ReactEditor } from "slate-react";
3
+ import { createEditor, Transforms, Editor } from "slate";
4
4
  import withCommon from "./hooks/withCommon";
5
5
  import { getBlock, getMarked, serializeMentions } from "./utils/chatEditor/SlateUtilityFunctions";
6
6
  import MiniTextFormat from "./Toolbar/PopupTool/MiniTextFormat";
@@ -33,15 +33,15 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
33
33
  isMobile = false,
34
34
  debounceTimeOut = 10,
35
35
  isMarkDown = false,
36
- markDownContent = '',
36
+ markDownContent = "",
37
37
  translation
38
38
  } = props;
39
39
  const classes = usePopupStyle(theme);
40
40
  const convertedContent = draftToSlate({
41
41
  data: content && content?.length > 0 ? content : [{
42
- type: 'paragraph',
42
+ type: "paragraph",
43
43
  children: [{
44
- text: ''
44
+ text: ""
45
45
  }]
46
46
  }]
47
47
  });
@@ -153,14 +153,6 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
153
153
  // needLayout = true,
154
154
  } = otherProps || {};
155
155
  const mentionsRef = useRef();
156
- const customProps = {
157
- ...(otherProps || {}),
158
- hideTools: ["settings", "add_column", "drag", "resize"],
159
- readOnly: isReadOnly,
160
- editorPlaceholder: "Write Something",
161
- page_id: 1,
162
- translation: translation || translationMock
163
- };
164
156
  const [mentions, setMentions] = useMentions({
165
157
  editor,
166
158
  selection: editor?.selection
@@ -222,6 +214,15 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
222
214
  debounced(newValue);
223
215
  debouncedValue.current = newValue;
224
216
  };
217
+ const dummyTranslation = () => {};
218
+ const customProps = {
219
+ ...(otherProps || {}),
220
+ hideTools: ["settings", "add_column", "drag", "resize"],
221
+ readOnly: isReadOnly,
222
+ editorPlaceholder: "Write Something",
223
+ page_id: 1,
224
+ translation: translation || translationMock || dummyTranslation
225
+ };
225
226
  const Element = props => {
226
227
  return getBlock(props);
227
228
  };
@@ -257,7 +258,7 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
257
258
  editor
258
259
  });
259
260
  } else if (event.key === "Enter" && !isMobile) {
260
- const isEmpty = debouncedValue?.current.length === 1 && debouncedValue?.current[0].type === 'paragraph' && debouncedValue?.current[0].children.length === 1 && debouncedValue?.current[0].children[0].text === '';
261
+ const isEmpty = debouncedValue?.current.length === 1 && debouncedValue?.current[0].type === "paragraph" && debouncedValue?.current[0].children.length === 1 && debouncedValue?.current[0].children[0].text === "";
261
262
  if (isEmpty) {
262
263
  event.preventDefault();
263
264
  return;
@@ -297,10 +298,10 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
297
298
  }
298
299
  };
299
300
 
301
+ const html = isMarkDown ? convertMDToHTML(markDownContent) : null;
300
302
  const handleFocus = () => {
301
303
  setIsFocused(true);
302
304
  };
303
- const html = isMarkDown ? convertMDToHTML(markDownContent) : null;
304
305
  return !isMarkDown ? /*#__PURE__*/_jsx(EditorProvider, {
305
306
  theme: theme,
306
307
  editor: editor,
@@ -314,13 +315,13 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
314
315
  closeMainPopup: handleClose,
315
316
  customProps: customProps
316
317
  }), /*#__PURE__*/_jsx(Editable, {
317
- onFocus: handleFocus,
318
318
  className: "chatEditorRoot",
319
319
  renderElement: renderElement,
320
320
  renderLeaf: renderLeaf,
321
321
  decorate: decorators,
322
322
  placeholder: "Start typing ...",
323
323
  spellCheck: true,
324
+ onFocus: handleFocus,
324
325
  onBlur: handleBlur,
325
326
  onKeyDown: onKeyDown,
326
327
  onPaste: handlePaste,
@@ -1,7 +1,7 @@
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 PropTypes from "prop-types";
4
- import { createEditor, Range, Transforms } from "slate";
4
+ import { createEditor, Editor, Range, Transforms } from "slate";
5
5
  import { Slate, Editable, ReactEditor } from "slate-react";
6
6
  import { useDebouncedCallback } from "use-debounce";
7
7
  import { getMarked, getBlock } from "./utils/SlateUtilityFunctions";
@@ -10,14 +10,14 @@ 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, upDownArrowKeyEvents } from "./utils/events";
13
+ import { mentionsEvent, commands, indentation, escapeEvent, enterEvent, upDownArrowKeyEvents, handleAccordionOnBackspace } from "./utils/events";
14
14
  import withCommon from "./hooks/withCommon";
15
15
  import DialogWrapper from "./DialogWrapper";
16
16
  import { serializeToText } from "./utils/serializeToText";
17
17
  import { getPageSettings } from "./utils/pageSettings";
18
18
  import { getThumbnailImage, invertColor, pageTextStyle } from "./helper";
19
19
  import PopupTool from "./Toolbar/PopupTool";
20
- import { Box, Typography, useTheme } from "@mui/material";
20
+ import { Box, Typography, useTheme, IconButton } from "@mui/material";
21
21
  import Shorthands from "./common/Shorthands";
22
22
  import MiniToolbar from "./Toolbar/Mini/MiniToolbar";
23
23
  import { EditorProvider } from "./hooks/useMouseMove";
@@ -26,9 +26,12 @@ import editorStyles from "./Styles/EditorStyles";
26
26
  import DragAndDrop from "./common/DnD";
27
27
  import Section from "./common/Section";
28
28
  import decorators from "./utils/Decorators";
29
- import { getBreakpointLineSpacing, getTRBLBreakPoints } from "./helper/theme";
30
- import { getInitialValue, handleInsertLastElement, isEverythingSelected, isFreeGrid, isFreeGridFragment, isRestrictedNode, outsideEditorClickLabel } from "./utils/helper";
29
+ import { getTRBLBreakPoints, getVariableValue, getBreakpointLineSpacing } from "./helper/theme";
30
+ import { getInitialValue, handleCopy, handleInsertLastElement, isEverythingSelected, isFreeGrid, isFreeGridFragment, isRestrictedNode, outsideEditorClickLabel } from "./utils/helper";
31
31
  import useWindowResize from "./hooks/useWindowResize";
32
+ import { getTheme } from "./theme";
33
+ import ThemeSettings from "./themeSettings";
34
+ import ThemeSettingsAI from "./themeSettingsAI";
32
35
  import PopoverAIInput from "./Elements/AI/PopoverAIInput";
33
36
  import RnDCopy from "./common/RnD/RnDCopy";
34
37
  import SwitchViewport from "./common/RnD/SwitchViewport/SwitchViewport";
@@ -37,9 +40,12 @@ import "./font.css";
37
40
  import "./Editor.css";
38
41
  import "animate.css";
39
42
  import FontLoader from "./common/FontLoader/FontLoader";
43
+ import { ThemeAIIcon, ThemePaintIcon } from "./assets/svg/ThemeIcons";
40
44
  import { CustomDialogComponent } from "./common/CustomDialog";
45
+ import { extractTextWithPath, replaceTextPath } from "./helper/textIndeces.js";
41
46
  import { jsx as _jsx } from "react/jsx-runtime";
42
47
  import { jsxs as _jsxs } from "react/jsx-runtime";
48
+ export const ThemeContext = /*#__PURE__*/createContext(null);
43
49
  const Item = /*#__PURE__*/forwardRef(({
44
50
  children,
45
51
  ...props
@@ -81,6 +87,7 @@ const updateTopBanner = (content = [], setTopBanner) => {
81
87
  return firstNode?.type === "topbanner" ? firstNode : null;
82
88
  });
83
89
  };
90
+ const dummyTranslation = () => {};
84
91
  const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
85
92
  const {
86
93
  id,
@@ -94,6 +101,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
94
101
  otherProps,
95
102
  isIframe,
96
103
  theme,
104
+ showThemeButtons,
97
105
  showViewport = false,
98
106
  overrideWrapperStyles = {},
99
107
  translation
@@ -101,7 +109,8 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
101
109
  const editorWrapper = useRef();
102
110
  const mentionsRef = useRef();
103
111
  const convertedContent = draftToSlate({
104
- data: content
112
+ data: content,
113
+ needLayout: otherProps?.needLayout
105
114
  });
106
115
  const [value, setValue] = useState(convertedContent);
107
116
  const [isInteracted, setIsInteracted] = useState(false);
@@ -145,10 +154,11 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
145
154
  const {
146
155
  bannerSpacing,
147
156
  pageBgImage,
148
- pageColor,
157
+ pageColor = "",
149
158
  color: pageTextColor,
150
159
  pageWidth,
151
160
  maxWidth: pageMaxWidth,
161
+ theme: selectedTheme,
152
162
  lineHeight
153
163
  } = pageSt?.pageProps || {
154
164
  bannerSpacing: {
@@ -160,10 +170,17 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
160
170
  };
161
171
  const classes = editorStyles({
162
172
  padHeight: !fullScreen ? otherProps?.padHeight : 20,
163
- placeHolderColor: invertColor(pageColor || "#FFF"),
173
+ placeHolderColor: invertColor(pageColor.startsWith("var") ? getVariableValue(pageColor) : pageColor || "#FFF"),
164
174
  theme,
165
175
  overrideWrapperStyles
166
176
  });
177
+ const [openTheme, setOpenTheme] = useState(false);
178
+ const [openAITheme, setOpenAITheme] = useState(false);
179
+ const [, setThemeUpdated] = useState(0);
180
+ const triggerRender = () => {
181
+ setThemeUpdated(prev => prev + 1); // Incrementing forces a re-render while updating theme
182
+ };
183
+
167
184
  const isMobile = window.matchMedia("(max-width: 899px)")?.matches || false;
168
185
  useEffect(() => {
169
186
  setValue(draftToSlate({
@@ -174,14 +191,25 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
174
191
  ReactEditor.focus(editor);
175
192
  }
176
193
  }, [id, content]);
194
+ useEffect(() => {
195
+ if (isReadOnly) {
196
+ const sectionId = window.location.hash.substring(1);
197
+ const sectionEle = sectionId ? document.getElementById(decodeURIComponent(sectionId)) : null;
198
+ if (sectionEle) {
199
+ sectionEle.scrollIntoView({
200
+ behavior: "smooth"
201
+ });
202
+ }
203
+ }
204
+ }, []);
177
205
  const debounced = useDebouncedCallback(
178
206
  // function
179
207
  value => {
208
+ debouncedValue.current = value;
180
209
  const {
181
210
  value: strVal,
182
211
  ...restVal
183
212
  } = getOnSaveData(value);
184
- debouncedValue.current = value;
185
213
  onSave(strVal, restVal);
186
214
  },
187
215
  // delay in ms
@@ -192,7 +220,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
192
220
  return {
193
221
  value: JSON.stringify(val),
194
222
  text: text,
195
- title: serializeToText(title?.children) || "Untitled"
223
+ title: serializeToText(title?.children) || ""
196
224
  };
197
225
  };
198
226
  const getTitleSaveData = title => {
@@ -305,6 +333,12 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
305
333
  redo() {
306
334
  editor?.redo();
307
335
  },
336
+ toggleTheme() {
337
+ setOpenTheme(!openTheme);
338
+ },
339
+ toggleAITheme() {
340
+ setOpenAITheme(!openAITheme);
341
+ },
308
342
  getPageSettings: {
309
343
  background: pageBgImage && pageBgImage !== "none" ? `url(${pageBgImage})` : pageColor || ""
310
344
  }
@@ -428,6 +462,10 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
428
462
  } else if (event.key === "ArrowDown" && otherProps?.tagName !== "Pages") {
429
463
  upDownArrowKeyEvents(event, editor);
430
464
  } else if (event.key === "Backspace") {
465
+ const isAccordion = handleAccordionOnBackspace(event, editor);
466
+ if (isAccordion) {
467
+ return;
468
+ }
431
469
  const isNodeRestricted = isRestrictedNode(event, editor);
432
470
  if (isNodeRestricted) {
433
471
  return;
@@ -503,6 +541,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
503
541
  }
504
542
  return style;
505
543
  }, [pageBgImage, pageColor, pageTextColor]);
544
+ const themeProps = getTheme(selectedTheme);
506
545
 
507
546
  // const handleContextMenu = (e) => {
508
547
  // if (!readOnly) {
@@ -533,19 +572,80 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
533
572
  console.log("handleCursorScroll", err);
534
573
  }
535
574
  };
575
+ window.getTextIndeces = () => {
576
+ try {
577
+ const textWithPaths = extractTextWithPath(editor.children, []);
578
+ return textWithPaths;
579
+ } catch (err) {
580
+ console.log(err);
581
+ }
582
+ };
583
+ window.replaceTextIndeces = (path_data = []) => {
584
+ try {
585
+ const replacedJson = replaceTextPath(JSON.parse(JSON.stringify(editor.children)), path_data);
586
+
587
+ // loop delete all
588
+ editor.children.forEach(() => {
589
+ Transforms.delete(editor, {
590
+ at: [0]
591
+ });
592
+ });
593
+
594
+ // Insert new nodes
595
+ Transforms.insertNodes(editor, replacedJson, {
596
+ at: [0]
597
+ });
598
+ } catch (err) {
599
+ console.log(err);
600
+ }
601
+ };
602
+ window.replaceEditorContent = (fragments = []) => {
603
+ try {
604
+ // loop delete all
605
+ editor.children.forEach(() => {
606
+ Transforms.delete(editor, {
607
+ at: [0]
608
+ });
609
+ });
610
+
611
+ // Insert new nodes
612
+ Transforms.insertNodes(editor, fragments, {
613
+ at: [0]
614
+ });
615
+ } catch (err) {
616
+ console.log(err);
617
+ }
618
+ };
536
619
  return /*#__PURE__*/_jsxs(EditorProvider, {
537
620
  theme: theme,
538
621
  editor: editor,
622
+ openTheme: openTheme,
623
+ setOpenTheme: setOpenTheme,
624
+ triggerRender: triggerRender,
539
625
  children: [/*#__PURE__*/_jsx(FontLoader, {
540
626
  otherProps: {
541
627
  services: otherProps?.services
542
628
  },
543
629
  readOnly: readOnly
544
- }), /*#__PURE__*/_jsx(DialogWrapper, {
630
+ }), showThemeButtons ? /*#__PURE__*/_jsxs("div", {
631
+ className: "theme-buttons",
632
+ children: [/*#__PURE__*/_jsx(IconButton, {
633
+ onClick: () => setOpenTheme(true),
634
+ className: "themePaintIcon",
635
+ children: /*#__PURE__*/_jsx(ThemePaintIcon, {})
636
+ }), /*#__PURE__*/_jsx(IconButton, {
637
+ onClick: () => setOpenAITheme(true),
638
+ style: {
639
+ marginTop: "4px"
640
+ },
641
+ children: /*#__PURE__*/_jsx(ThemeAIIcon, {})
642
+ })]
643
+ }) : null, /*#__PURE__*/_jsx(DialogWrapper, {
545
644
  classes: classes,
546
645
  ...props,
547
646
  fullScreen: fullScreen,
548
647
  footer: footer || "",
648
+ selectedTheme: selectedTheme,
549
649
  children: /*#__PURE__*/_jsx(Box, {
550
650
  component: "div",
551
651
  className: `et-wrpr stimulate-${breakpoint} ${editorClass || ""} ${isIframe ? "iframe-editor" : ""}`,
@@ -580,6 +680,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
580
680
  children: /*#__PURE__*/_jsxs(Box, {
581
681
  component: "div",
582
682
  className: "max-content",
683
+ sx: themeProps?.sxProps || {},
583
684
  "data-info": outsideEditorClickLabel,
584
685
  children: [renderTopBanner(), /*#__PURE__*/_jsx("div", {
585
686
  className: "scroll-area",
@@ -613,7 +714,8 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
613
714
  onSelect: () => handleCursorScroll(editorWrapper.current),
614
715
  scrollSelectionIntoView: () => {
615
716
  // disable the scrollSelectionIntoView, to resolve editor auto scroll on free-grid
616
- }
717
+ },
718
+ onCopy: e => handleCopy(e, editor)
617
719
  }), !readOnly ? /*#__PURE__*/_jsx(MentionsPopup, {
618
720
  ref: mentionsRef,
619
721
  mentions: mentions,
@@ -624,8 +726,8 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
624
726
  chars: chars,
625
727
  type: type,
626
728
  theme: theme,
627
- otherProps: customProps,
628
- customProps: customProps
729
+ customProps: customProps,
730
+ otherProps: customProps
629
731
  }) : null, /*#__PURE__*/_jsx(RnDCopy, {
630
732
  readOnly: readOnly
631
733
  })]
@@ -648,6 +750,18 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
648
750
  "data-info": outsideEditorClickLabel,
649
751
  onClick: handleFooterClick,
650
752
  children: footer
753
+ }), openTheme ? /*#__PURE__*/_jsx(ThemeSettings, {
754
+ open: openTheme,
755
+ setOpen: setOpenTheme,
756
+ editor: editor,
757
+ services: otherProps?.services,
758
+ appTheme: theme,
759
+ customProps: customProps
760
+ }) : null, /*#__PURE__*/_jsx(ThemeSettingsAI, {
761
+ openAITheme: openAITheme,
762
+ setOpenAITheme: setOpenAITheme,
763
+ onSaveTheme: otherProps?.onSaveTheme,
764
+ theme: theme
651
765
  })]
652
766
  })
653
767
  }), !readOnly ? /*#__PURE__*/_jsx(PopupTool, {
@@ -656,8 +770,9 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
656
770
  setIsTextSelected: setIsTextSelected,
657
771
  customProps: customProps,
658
772
  editorWrapper: editorWrapper
659
- }) : null, !readOnly && showViewport ? /*#__PURE__*/_jsx(SwitchViewport, {
773
+ }) : null, !readOnly ? /*#__PURE__*/_jsx(SwitchViewport, {
660
774
  breakpoint: breakpoint,
775
+ show: showViewport,
661
776
  onChange: b => onSwitchBreakpoint(b),
662
777
  translation: translationFn
663
778
  }) : null]
@@ -2,6 +2,7 @@ import React from "react";
2
2
  import { Dialog, DialogTitle, DialogContent, IconButton, Grid } from "@mui/material";
3
3
  import CloseIcon from "@mui/icons-material/Close";
4
4
  import ViewportStimulator from "./common/RnD/Theme/ViewportStimulator";
5
+ import MainThemeProvider from "./common/RnD/Theme/MainThemeProvider";
5
6
  import { jsx as _jsx } from "react/jsx-runtime";
6
7
  import { jsxs as _jsxs } from "react/jsx-runtime";
7
8
  const DialogWrapper = props => {
@@ -9,40 +10,45 @@ const DialogWrapper = props => {
9
10
  fullScreen,
10
11
  onClose,
11
12
  children,
12
- classes
13
+ classes,
14
+ selectedTheme
13
15
  } = props;
14
- return fullScreen ? /*#__PURE__*/_jsxs(Dialog, {
15
- className: `dialogComp`,
16
- open: fullScreen,
17
- fullScreen: fullScreen,
18
- onClose: onClose,
19
- style: {
20
- zIndex: 1000
21
- },
22
- sx: classes.fullScreenWrapper,
23
- children: [/*#__PURE__*/_jsx(DialogTitle, {
16
+ return fullScreen ? /*#__PURE__*/_jsx(MainThemeProvider, {
17
+ userSelectedTheme: selectedTheme,
18
+ children: /*#__PURE__*/_jsxs(Dialog, {
19
+ className: `dialogComp`,
20
+ open: fullScreen,
21
+ fullScreen: fullScreen,
22
+ onClose: onClose,
24
23
  style: {
25
- padding: "6px 8px"
24
+ zIndex: 1000
26
25
  },
27
- children: /*#__PURE__*/_jsx(Grid, {
26
+ sx: classes.fullScreenWrapper,
27
+ children: [/*#__PURE__*/_jsx(DialogTitle, {
28
+ style: {
29
+ padding: "6px 8px"
30
+ },
28
31
  children: /*#__PURE__*/_jsx(Grid, {
29
- style: {
30
- display: "flex",
31
- justifyContent: "end"
32
- },
33
- children: /*#__PURE__*/_jsx(IconButton, {
34
- onClick: onClose,
32
+ children: /*#__PURE__*/_jsx(Grid, {
35
33
  style: {
36
- background: "rgba(255,255,255,0.5)"
34
+ display: "flex",
35
+ justifyContent: "end"
37
36
  },
38
- children: /*#__PURE__*/_jsx(CloseIcon, {})
37
+ children: /*#__PURE__*/_jsx(IconButton, {
38
+ onClick: onClose,
39
+ style: {
40
+ background: "rgba(255,255,255,0.5)"
41
+ },
42
+ children: /*#__PURE__*/_jsx(CloseIcon, {})
43
+ })
39
44
  })
40
45
  })
41
- })
42
- }), /*#__PURE__*/_jsx(DialogContent, {
43
- children: children
44
- })]
46
+ }), /*#__PURE__*/_jsx(DialogContent, {
47
+ children: children
48
+ })]
49
+ })
45
50
  }) : /*#__PURE__*/_jsx(ViewportStimulator, {
51
+ selectedTheme: selectedTheme,
46
52
  children: children
47
53
  });
48
54
  };
@@ -426,6 +426,32 @@ blockquote {
426
426
 
427
427
  .upload-sign-img-wrapper {
428
428
  text-align: center;
429
+ position: relative;
430
+ }
431
+
432
+ .upload-sign-img {
433
+ max-width: 100%;
434
+ }
435
+
436
+ .remove-sign-img-btn {
437
+ padding: 8px 12px;
438
+ background-color: #ffffff68;
439
+ cursor: pointer;
440
+ width: fit-content;
441
+ border-radius: 8px;
442
+ position: absolute;
443
+ left: 50%;
444
+ top: 50%;
445
+ transform: translate(-50%, -50%);
446
+ display: none;
447
+ }
448
+
449
+ .remove-sign-img-btn:hover {
450
+ background-color: #ffffffa0;
451
+ }
452
+
453
+ .upload-sign-img-wrapper:hover .remove-sign-img-btn {
454
+ display: block;
429
455
  }
430
456
 
431
457
  .signature-tab img {
@@ -1342,21 +1368,33 @@ code.markcode {
1342
1368
  background-color: #f3f3f3;
1343
1369
  font-family: 'Source Code Pro' !important;
1344
1370
  }
1371
+
1345
1372
  /* Hide the popper when the reference is hidden */
1346
1373
  .hide-popper-on-overlap[data-popper-escaped],
1347
1374
  .hide-popper-on-overlap[data-popper-reference-hidden] {
1348
1375
  visibility: hidden;
1349
1376
  pointer-events: none;
1350
1377
  }
1351
- code.markcode {
1352
- border-radius: 4px;
1353
- padding: 6px 8px;
1354
- margin: 8px 0px;
1355
- display: block;
1356
- background-color: #f3f3f3;
1357
- font-family: 'Source Code Pro' !important;
1378
+
1379
+ .theme-buttons {
1380
+ display: flex;
1381
+ justify-content: end;
1382
+ align-items: center;
1383
+ margin: auto;
1384
+ position: absolute;
1385
+ top: 60px;
1386
+ right: 20px;
1387
+ z-index: 1000;
1388
+ }
1389
+
1390
+ .themePaintIcon:hover .iconBorder {
1391
+ fill: #2563EB;
1392
+ }
1393
+
1394
+ .themePaintIcon:hover .iconStroke {
1395
+ stroke: #2563EB;
1358
1396
  }
1359
1397
 
1360
1398
  .hyperLink {
1361
1399
  word-break: break-all;
1362
- }
1400
+ }
@@ -167,6 +167,7 @@ function PopoverAIInput({
167
167
  const [generatedText, setGeneratedText] = useState("");
168
168
  const [inputValue, setInputValue] = useState("");
169
169
  const [selectedOption, setSelectedOption] = useState();
170
+ const [threadId, setThreadId] = useState("");
170
171
  const selectedEleRef = useRef({});
171
172
  const classes = Styles();
172
173
  const editor = useSlate();
@@ -188,6 +189,7 @@ function PopoverAIInput({
188
189
  useEffect(() => {
189
190
  if (openAI) {
190
191
  scrollToAIInput(editor);
192
+ setThreadId("");
191
193
  }
192
194
  }, [openAI]);
193
195
  useEffect(() => {
@@ -196,8 +198,12 @@ function PopoverAIInput({
196
198
  const framePayload = (type, option) => {
197
199
  let payload = {
198
200
  mode: option.mode || 0,
199
- query: option?.inputValue || inputValue
201
+ query: option?.inputValue || inputValue,
202
+ useSession: true
200
203
  };
204
+ if (threadId) {
205
+ payload.threadId = threadId;
206
+ }
201
207
  if (option.mode === MODES.translate || option.mode === MODES.rephraseTone) {
202
208
  payload.textOptionInput = type;
203
209
  }
@@ -257,12 +263,14 @@ function PopoverAIInput({
257
263
  setLoading(false);
258
264
  setInputValue("");
259
265
  let {
260
- data: text
261
- } = result || {};
266
+ body: text,
267
+ threadId
268
+ } = result?.data || {};
262
269
  if (!text) {
263
270
  onClickOutside();
264
271
  return;
265
272
  }
273
+ setThreadId(threadId || "");
266
274
 
267
275
  // if (!option.replace) {
268
276
  if (type === "continue_writing") {