@flozy/editor 10.6.7 → 10.6.8

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 (128) hide show
  1. package/dist/Editor/ChatEditor.js +17 -16
  2. package/dist/Editor/CommonEditor.js +116 -13
  3. package/dist/Editor/DialogWrapper.js +31 -25
  4. package/dist/Editor/Editor.css +31 -11
  5. package/dist/Editor/Elements/AI/PopoverAIInput.js +11 -3
  6. package/dist/Editor/Elements/AI/Styles.js +1 -0
  7. package/dist/Editor/Elements/Accordion/Accordion.js +25 -17
  8. package/dist/Editor/Elements/AppHeader/AppHeader.js +3 -3
  9. package/dist/Editor/Elements/Button/EditorButton.js +23 -7
  10. package/dist/Editor/Elements/Color Picker/ColorButtons.js +61 -14
  11. package/dist/Editor/Elements/Color Picker/ColorPicker.css +25 -1
  12. package/dist/Editor/Elements/Color Picker/ColorPicker.js +10 -7
  13. package/dist/Editor/Elements/Color Picker/Styles.js +15 -13
  14. package/dist/Editor/Elements/Embed/Video.js +1 -1
  15. package/dist/Editor/Elements/Form/FormField.js +1 -1
  16. package/dist/Editor/Elements/Form/Workflow/Styles.js +24 -22
  17. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +31 -30
  18. package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +7 -4
  19. package/dist/Editor/Elements/FreeGrid/Options/More.js +7 -7
  20. package/dist/Editor/Elements/FreeGrid/helper.js +115 -0
  21. package/dist/Editor/Elements/FreeGrid/styles.js +9 -0
  22. package/dist/Editor/Elements/Grid/GridItem.js +1 -1
  23. package/dist/Editor/Elements/SimpleText/style.js +2 -2
  24. package/dist/Editor/Elements/Table/Table.js +3 -3
  25. package/dist/Editor/Elements/Title/title.js +6 -6
  26. package/dist/Editor/Elements/Variables/VariableButton.js +10 -1
  27. package/dist/Editor/MiniEditor.js +2 -1
  28. package/dist/Editor/Styles/EditorStyles.js +9 -5
  29. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +27 -3
  30. package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +4 -3
  31. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
  32. package/dist/Editor/Toolbar/FormatTools/TextSize.js +10 -13
  33. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +2 -1
  34. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/MiniColorPicker.js +4 -2
  35. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +6 -13
  36. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectList.js +4 -2
  37. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +167 -42
  38. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +7 -4
  39. package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +2 -1
  40. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +69 -9
  41. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +58 -10
  42. package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +439 -0
  43. package/dist/Editor/Toolbar/PopupTool/index.js +5 -2
  44. package/dist/Editor/Toolbar/toolbarGroups.js +48 -6
  45. package/dist/Editor/assets/svg/BackIcon.js +18 -0
  46. package/dist/Editor/assets/svg/ThemeIcons.js +293 -0
  47. package/dist/Editor/common/ColorPickerButton.js +38 -16
  48. package/dist/Editor/common/CustomColorPicker/index.js +130 -0
  49. package/dist/Editor/common/CustomColorPicker/style.js +53 -0
  50. package/dist/Editor/common/CustomDialog2/index.js +94 -0
  51. package/dist/Editor/common/CustomDialog2/style.js +67 -0
  52. package/dist/Editor/common/CustomSelect.js +43 -0
  53. package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
  54. package/dist/Editor/common/FontLoader/FontLoader.js +3 -0
  55. package/dist/Editor/common/Icon.js +28 -0
  56. package/dist/Editor/common/ImageSelector/ImageSelector.js +2 -2
  57. package/dist/Editor/common/ImageSelector/Styles.js +3 -9
  58. package/dist/Editor/common/LinkSettings/NavComponents.js +6 -2
  59. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +2 -1
  60. package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +3 -2
  61. package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +3 -2
  62. package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +3 -2
  63. package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +3 -2
  64. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +4 -2
  65. package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +3 -2
  66. package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +3 -2
  67. package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +3 -1
  68. package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +3 -2
  69. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +11 -2
  70. package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +17 -0
  71. package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +6 -3
  72. package/dist/Editor/common/RnD/Utils/gridDropItem.js +28 -18
  73. package/dist/Editor/common/RnD/Utils/index.js +3 -1
  74. package/dist/Editor/common/RnD/VirtualElement/VirtualTextElement.js +45 -58
  75. package/dist/Editor/common/RnD/VirtualElement/helper.js +320 -130
  76. package/dist/Editor/common/RnD/VirtualElement/styles.js +22 -0
  77. package/dist/Editor/common/RnD/index.js +42 -11
  78. package/dist/Editor/common/Shorthands/elements.js +54 -0
  79. package/dist/Editor/common/StyleBuilder/buttonStyle.js +4 -2
  80. package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +4 -0
  81. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +5 -0
  82. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +12 -2
  83. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +15 -7
  84. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +16 -8
  85. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +36 -10
  86. package/dist/Editor/common/StyleBuilder/fieldTypes/embedUpload.js +115 -0
  87. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +16 -7
  88. package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +3 -1
  89. package/dist/Editor/common/StyleBuilder/fieldTypes/menusArray.js +2 -0
  90. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +15 -7
  91. package/dist/Editor/common/Uploader.js +16 -0
  92. package/dist/Editor/common/iconslist.js +21 -0
  93. package/dist/Editor/commonStyle.js +107 -64
  94. package/dist/Editor/helper/index.js +7 -2
  95. package/dist/Editor/helper/textIndeces.js +58 -0
  96. package/dist/Editor/helper/theme.js +203 -2
  97. package/dist/Editor/hooks/useEditorTheme.js +153 -0
  98. package/dist/Editor/hooks/useMouseMove.js +9 -3
  99. package/dist/Editor/hooks/useThemeValues.js +63 -0
  100. package/dist/Editor/plugins/withEmbeds.js +1 -1
  101. package/dist/Editor/plugins/withHTML.js +3 -1
  102. package/dist/Editor/plugins/withTable.js +1 -1
  103. package/dist/Editor/theme/ThemeList.js +50 -173
  104. package/dist/Editor/theme/index.js +149 -0
  105. package/dist/Editor/themeSettings/ActiveTheme.js +82 -0
  106. package/dist/Editor/themeSettings/buttons/index.js +300 -0
  107. package/dist/Editor/themeSettings/buttons/style.js +23 -0
  108. package/dist/Editor/themeSettings/colorTheme/index.js +310 -0
  109. package/dist/Editor/themeSettings/colorTheme/style.js +81 -0
  110. package/dist/Editor/themeSettings/fonts/PreviewElement.js +121 -0
  111. package/dist/Editor/themeSettings/fonts/index.js +240 -0
  112. package/dist/Editor/themeSettings/fonts/style.js +62 -0
  113. package/dist/Editor/themeSettings/icons.js +60 -0
  114. package/dist/Editor/themeSettings/index.js +380 -0
  115. package/dist/Editor/themeSettings/style.js +299 -0
  116. package/dist/Editor/themeSettingsAI/icons.js +96 -0
  117. package/dist/Editor/themeSettingsAI/index.js +355 -0
  118. package/dist/Editor/themeSettingsAI/saveTheme.js +202 -0
  119. package/dist/Editor/themeSettingsAI/style.js +332 -0
  120. package/dist/Editor/utils/SlateUtilityFunctions.js +229 -24
  121. package/dist/Editor/utils/accordion.js +50 -24
  122. package/dist/Editor/utils/button.js +1 -17
  123. package/dist/Editor/utils/draftToSlate.js +3 -2
  124. package/dist/Editor/utils/font.js +40 -37
  125. package/dist/Editor/utils/helper.js +97 -21
  126. package/dist/Editor/utils/insertAppHeader.js +8 -4
  127. package/package.json +4 -4
  128. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/MultiSelect.js +0 -454
@@ -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";
@@ -17,7 +17,7 @@ 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";
29
+ import { getTRBLBreakPoints, getVariableValue, getBreakpointLineSpacing } from "./helper/theme";
30
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({
@@ -188,11 +205,11 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
188
205
  const debounced = useDebouncedCallback(
189
206
  // function
190
207
  value => {
208
+ debouncedValue.current = value;
191
209
  const {
192
210
  value: strVal,
193
211
  ...restVal
194
212
  } = getOnSaveData(value);
195
- debouncedValue.current = value;
196
213
  onSave(strVal, restVal);
197
214
  },
198
215
  // delay in ms
@@ -203,7 +220,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
203
220
  return {
204
221
  value: JSON.stringify(val),
205
222
  text: text,
206
- title: serializeToText(title?.children) || "Untitled"
223
+ title: serializeToText(title?.children) || ""
207
224
  };
208
225
  };
209
226
  const getTitleSaveData = title => {
@@ -220,8 +237,12 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
220
237
  const getPreviewImage = async (needBackground = false, options = {}) => {
221
238
  ReactEditor.blur(editor);
222
239
  const dom = needBackground ? editorWrapper?.current : editorWrapper?.current.getElementsByClassName("innert-editor-textbox")[0];
240
+ const pageBg = options?.fromBrains ? {
241
+ pageColor
242
+ } : {};
223
243
  const c = await getThumbnailImage(dom, {
224
244
  ...options,
245
+ ...pageBg,
225
246
  proxy: `${otherProps?.PAGES_API_HOST}/page/2canvas`
226
247
  });
227
248
  return c;
@@ -316,6 +337,12 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
316
337
  redo() {
317
338
  editor?.redo();
318
339
  },
340
+ toggleTheme() {
341
+ setOpenTheme(!openTheme);
342
+ },
343
+ toggleAITheme() {
344
+ setOpenAITheme(!openAITheme);
345
+ },
319
346
  getPageSettings: {
320
347
  background: pageBgImage && pageBgImage !== "none" ? `url(${pageBgImage})` : pageColor || ""
321
348
  }
@@ -519,6 +546,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
519
546
  }
520
547
  return style;
521
548
  }, [pageBgImage, pageColor, pageTextColor]);
549
+ const themeProps = getTheme(selectedTheme);
522
550
 
523
551
  // const handleContextMenu = (e) => {
524
552
  // if (!readOnly) {
@@ -549,19 +577,80 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
549
577
  console.log("handleCursorScroll", err);
550
578
  }
551
579
  };
580
+ window.getTextIndeces = () => {
581
+ try {
582
+ const textWithPaths = extractTextWithPath(editor.children, []);
583
+ return textWithPaths;
584
+ } catch (err) {
585
+ console.log(err);
586
+ }
587
+ };
588
+ window.replaceTextIndeces = (path_data = []) => {
589
+ try {
590
+ const replacedJson = replaceTextPath(JSON.parse(JSON.stringify(editor.children)), path_data);
591
+
592
+ // loop delete all
593
+ editor.children.forEach(() => {
594
+ Transforms.delete(editor, {
595
+ at: [0]
596
+ });
597
+ });
598
+
599
+ // Insert new nodes
600
+ Transforms.insertNodes(editor, replacedJson, {
601
+ at: [0]
602
+ });
603
+ } catch (err) {
604
+ console.log(err);
605
+ }
606
+ };
607
+ window.replaceEditorContent = (fragments = []) => {
608
+ try {
609
+ // loop delete all
610
+ editor.children.forEach(() => {
611
+ Transforms.delete(editor, {
612
+ at: [0]
613
+ });
614
+ });
615
+
616
+ // Insert new nodes
617
+ Transforms.insertNodes(editor, fragments, {
618
+ at: [0]
619
+ });
620
+ } catch (err) {
621
+ console.log(err);
622
+ }
623
+ };
552
624
  return /*#__PURE__*/_jsxs(EditorProvider, {
553
625
  theme: theme,
554
626
  editor: editor,
627
+ openTheme: openTheme,
628
+ setOpenTheme: setOpenTheme,
629
+ triggerRender: triggerRender,
555
630
  children: [/*#__PURE__*/_jsx(FontLoader, {
556
631
  otherProps: {
557
632
  services: otherProps?.services
558
633
  },
559
634
  readOnly: readOnly
560
- }), /*#__PURE__*/_jsx(DialogWrapper, {
635
+ }), showThemeButtons ? /*#__PURE__*/_jsxs("div", {
636
+ className: "theme-buttons",
637
+ children: [/*#__PURE__*/_jsx(IconButton, {
638
+ onClick: () => setOpenTheme(true),
639
+ className: "themePaintIcon",
640
+ children: /*#__PURE__*/_jsx(ThemePaintIcon, {})
641
+ }), /*#__PURE__*/_jsx(IconButton, {
642
+ onClick: () => setOpenAITheme(true),
643
+ style: {
644
+ marginTop: "4px"
645
+ },
646
+ children: /*#__PURE__*/_jsx(ThemeAIIcon, {})
647
+ })]
648
+ }) : null, /*#__PURE__*/_jsx(DialogWrapper, {
561
649
  classes: classes,
562
650
  ...props,
563
651
  fullScreen: fullScreen,
564
652
  footer: footer || "",
653
+ selectedTheme: selectedTheme,
565
654
  children: /*#__PURE__*/_jsx(Box, {
566
655
  component: "div",
567
656
  className: `et-wrpr stimulate-${breakpoint} ${editorClass || ""} ${isIframe ? "iframe-editor" : ""}`,
@@ -596,6 +685,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
596
685
  children: /*#__PURE__*/_jsxs(Box, {
597
686
  component: "div",
598
687
  className: "max-content",
688
+ sx: themeProps?.sxProps || {},
599
689
  "data-info": outsideEditorClickLabel,
600
690
  children: [renderTopBanner(), /*#__PURE__*/_jsx("div", {
601
691
  className: "scroll-area",
@@ -641,8 +731,8 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
641
731
  chars: chars,
642
732
  type: type,
643
733
  theme: theme,
644
- otherProps: customProps,
645
- customProps: customProps
734
+ customProps: customProps,
735
+ otherProps: customProps
646
736
  }) : null, /*#__PURE__*/_jsx(RnDCopy, {
647
737
  readOnly: readOnly
648
738
  })]
@@ -665,6 +755,18 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
665
755
  "data-info": outsideEditorClickLabel,
666
756
  onClick: handleFooterClick,
667
757
  children: footer
758
+ }), openTheme ? /*#__PURE__*/_jsx(ThemeSettings, {
759
+ open: openTheme,
760
+ setOpen: setOpenTheme,
761
+ editor: editor,
762
+ services: otherProps?.services,
763
+ appTheme: theme,
764
+ customProps: customProps
765
+ }) : null, /*#__PURE__*/_jsx(ThemeSettingsAI, {
766
+ openAITheme: openAITheme,
767
+ setOpenAITheme: setOpenAITheme,
768
+ onSaveTheme: otherProps?.onSaveTheme,
769
+ theme: theme
668
770
  })]
669
771
  })
670
772
  }), !readOnly ? /*#__PURE__*/_jsx(PopupTool, {
@@ -673,8 +775,9 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
673
775
  setIsTextSelected: setIsTextSelected,
674
776
  customProps: customProps,
675
777
  editorWrapper: editorWrapper
676
- }) : null, !readOnly && showViewport ? /*#__PURE__*/_jsx(SwitchViewport, {
778
+ }) : null, !readOnly ? /*#__PURE__*/_jsx(SwitchViewport, {
677
779
  breakpoint: breakpoint,
780
+ show: showViewport,
678
781
  onChange: b => onSwitchBreakpoint(b),
679
782
  translation: translationFn
680
783
  }) : 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
  };
@@ -1132,6 +1132,14 @@ blockquote {
1132
1132
  margin: 0px;
1133
1133
  }
1134
1134
 
1135
+ .listItemMargin .accordion-container {
1136
+ margin-left: -20px;
1137
+ }
1138
+
1139
+ .accordion-summary-container li:first-child {
1140
+ list-style: none;
1141
+ }
1142
+
1135
1143
  .content-editable.empty {
1136
1144
  position: relative;
1137
1145
  }
@@ -1342,16 +1350,16 @@ blockquote {
1342
1350
 
1343
1351
  ::selection {
1344
1352
  color: inherit;
1345
- background: rgba(35, 131, 226, 0.35) !important;
1353
+ /* background: rgba(35, 131, 226, 0.35) !important; */
1346
1354
  }
1347
1355
 
1348
1356
  ::-moz-selection {
1349
- background: rgba(35, 131, 226, 0.35) !important;
1357
+ /* background: rgba(35, 131, 226, 0.35) !important; */
1350
1358
  color: inherit;
1351
1359
  }
1352
1360
 
1353
1361
  ::-webkit-selection {
1354
- background: rgba(35, 131, 226, 0.35) !important;
1362
+ /* background: rgba(35, 131, 226, 0.35) !important; */
1355
1363
  color: inherit;
1356
1364
  }
1357
1365
 
@@ -1368,21 +1376,33 @@ code.markcode {
1368
1376
  background-color: #f3f3f3;
1369
1377
  font-family: 'Source Code Pro' !important;
1370
1378
  }
1379
+
1371
1380
  /* Hide the popper when the reference is hidden */
1372
1381
  .hide-popper-on-overlap[data-popper-escaped],
1373
1382
  .hide-popper-on-overlap[data-popper-reference-hidden] {
1374
1383
  visibility: hidden;
1375
1384
  pointer-events: none;
1376
1385
  }
1377
- code.markcode {
1378
- border-radius: 4px;
1379
- padding: 6px 8px;
1380
- margin: 8px 0px;
1381
- display: block;
1382
- background-color: #f3f3f3;
1383
- font-family: 'Source Code Pro' !important;
1386
+
1387
+ .theme-buttons {
1388
+ display: flex;
1389
+ justify-content: end;
1390
+ align-items: center;
1391
+ margin: auto;
1392
+ position: absolute;
1393
+ top: 60px;
1394
+ right: 20px;
1395
+ z-index: 1000;
1396
+ }
1397
+
1398
+ .themePaintIcon:hover .iconBorder {
1399
+ fill: #2563EB;
1400
+ }
1401
+
1402
+ .themePaintIcon:hover .iconStroke {
1403
+ stroke: #2563EB;
1384
1404
  }
1385
1405
 
1386
1406
  .hyperLink {
1387
1407
  word-break: break-all;
1388
- }
1408
+ }
@@ -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") {
@@ -145,6 +145,7 @@ const Styles = theme => ({
145
145
  "& .option-label": {
146
146
  display: "flex",
147
147
  alignItems: "center",
148
+ whiteSpace: 'nowrap',
148
149
  gap: "8px"
149
150
  },
150
151
  "&:hover": {
@@ -1,5 +1,5 @@
1
- import React, { useEffect, useState } from "react";
2
- import { Editor, Range, Transforms } from "slate";
1
+ import React, { useState } from "react";
2
+ import { Transforms } from "slate";
3
3
  import { useSelected, useSlateStatic, ReactEditor } from "slate-react";
4
4
  import AccordionBtnPopup from "./AccordionBtnPopup";
5
5
  import { IconButton, Tooltip, Box } from "@mui/material";
@@ -94,22 +94,30 @@ const Accordion = props => {
94
94
  theme
95
95
  } = useEditorContext();
96
96
  const classes = useCommonStyle(theme);
97
- useEffect(() => {
98
- if (!editor.selection || !children[1]) return;
99
- try {
100
- const accordionDetailsElement = element.children?.[1];
101
- const detailsPath = ReactEditor.findPath(editor, accordionDetailsElement);
102
- const detailsRange = Editor.range(editor, detailsPath);
103
- const isInside = Range.intersection(detailsRange, editor.selection);
104
- if (isInside && !toggle) {
105
- setToggle(true);
106
- }
107
- } catch (e) {
108
- console.error(e);
109
- }
110
- }, [editor.selection, children]);
97
+
98
+ // useEffect(() => {
99
+ // if (!editor.selection || !children[1]) return;
100
+
101
+ // try {
102
+ // const accordionDetailsElement = element.children?.[1];
103
+
104
+ // const detailsPath = ReactEditor.findPath(editor, accordionDetailsElement);
105
+
106
+ // const detailsRange = Editor.range(editor, detailsPath);
107
+
108
+ // const isInside = Range.intersection(detailsRange, editor.selection);
109
+
110
+ // if (isInside && !toggle) {
111
+ // setToggle(true);
112
+ // }
113
+ // } catch (e) {
114
+ // console.error(e);
115
+ // }
116
+ // }, [editor.selection, children]);
117
+
111
118
  const onToggle = () => {
112
119
  setToggle(!toggle);
120
+ Transforms.deselect(editor);
113
121
  };
114
122
  const ToolBar = () => {
115
123
  return selected && !showTool ? /*#__PURE__*/_jsxs("div", {
@@ -206,7 +214,6 @@ const Accordion = props => {
206
214
  className: "accordion-title"
207
215
  // style={{ background: bgColor, ...borderStyle }}
208
216
  ,
209
- onClick: onToggle,
210
217
  children: [/*#__PURE__*/_jsx(Box, {
211
218
  role: "button",
212
219
  className: "accordion-summary-collapse-btn",
@@ -221,6 +228,7 @@ const Accordion = props => {
221
228
  },
222
229
  cursor: "pointer"
223
230
  },
231
+ onClick: onToggle,
224
232
  children: !toggle ? /*#__PURE__*/_jsx(Icon, {
225
233
  icon: "accordionArrow"
226
234
  }) : /*#__PURE__*/_jsx(Icon, {