@flozy/editor 6.0.5 → 6.0.7

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 (129) hide show
  1. package/dist/Editor/ChatEditor.js +7 -7
  2. package/dist/Editor/CommonEditor.js +81 -25
  3. package/dist/Editor/DialogWrapper.js +31 -25
  4. package/dist/Editor/Editor.css +22 -16
  5. package/dist/Editor/Elements/AI/PopoverAIInput.js +2 -12
  6. package/dist/Editor/Elements/AppHeader/AppHeader.js +3 -3
  7. package/dist/Editor/Elements/Button/EditorButton.js +26 -9
  8. package/dist/Editor/Elements/Color Picker/ColorButtons.js +57 -12
  9. package/dist/Editor/Elements/Color Picker/ColorPicker.css +25 -1
  10. package/dist/Editor/Elements/Color Picker/ColorPicker.js +4 -4
  11. package/dist/Editor/Elements/Color Picker/Styles.js +1 -1
  12. package/dist/Editor/Elements/DataView/DataView.js +4 -3
  13. package/dist/Editor/Elements/DataView/Layouts/DataTypes/NumberType.js +5 -1
  14. package/dist/Editor/Elements/DataView/Layouts/DataTypes/TextType.js +5 -1
  15. package/dist/Editor/Elements/DataView/Layouts/FilterView.js +23 -19
  16. package/dist/Editor/Elements/DataView/Providers/DataViewProvider.js +1 -1
  17. package/dist/Editor/Elements/Embed/Image.js +2 -2
  18. package/dist/Editor/Elements/Form/Form.js +1 -0
  19. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +0 -14
  20. package/dist/Editor/Elements/FreeGrid/styles.js +4 -0
  21. package/dist/Editor/Elements/Grid/GridItem.js +2 -3
  22. package/dist/Editor/Elements/Link/Link.js +70 -43
  23. package/dist/Editor/Elements/List/CheckList.js +2 -1
  24. package/dist/Editor/Elements/Search/SearchAttachment.js +1 -0
  25. package/dist/Editor/Elements/Search/SearchList.js +8 -1
  26. package/dist/Editor/Elements/SimpleText/index.js +8 -1
  27. package/dist/Editor/Elements/SimpleText/style.js +5 -1
  28. package/dist/Editor/Elements/Table/Table.js +3 -3
  29. package/dist/Editor/Elements/Table/TableCell.js +14 -9
  30. package/dist/Editor/Elements/Title/title.js +13 -1
  31. package/dist/Editor/Elements/Variables/Style.js +28 -2
  32. package/dist/Editor/Elements/Variables/VariableButton.js +17 -4
  33. package/dist/Editor/MiniEditor.js +4 -2
  34. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +27 -3
  35. package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +4 -3
  36. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
  37. package/dist/Editor/Toolbar/FormatTools/TextSize.js +7 -15
  38. package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +46 -36
  39. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectAlignment.js +3 -1
  40. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +6 -13
  41. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectList.js +3 -1
  42. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +211 -91
  43. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +11 -4
  44. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +16 -12
  45. package/dist/Editor/Toolbar/PopupTool/TemplateCard.js +1 -1
  46. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +99 -7
  47. package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +438 -0
  48. package/dist/Editor/Toolbar/PopupTool/index.js +2 -0
  49. package/dist/Editor/Toolbar/toolbarGroups.js +48 -6
  50. package/dist/Editor/assets/svg/ThemeIcons.js +291 -0
  51. package/dist/Editor/common/ColorPickerButton.js +32 -9
  52. package/dist/Editor/common/CustomColorPicker/index.js +106 -0
  53. package/dist/Editor/common/CustomColorPicker/style.js +53 -0
  54. package/dist/Editor/common/CustomDialog/index.js +94 -0
  55. package/dist/Editor/common/CustomDialog/style.js +67 -0
  56. package/dist/Editor/common/CustomSelect.js +33 -0
  57. package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
  58. package/dist/Editor/common/DnD/Draggable.js +0 -1
  59. package/dist/Editor/common/FontLoader/FontList.js +1 -9
  60. package/dist/Editor/common/FontLoader/FontLoader.js +6 -4
  61. package/dist/Editor/common/Icon.js +28 -0
  62. package/dist/Editor/common/ImageSelector/Styles.js +3 -9
  63. package/dist/Editor/common/MentionsPopup/Styles.js +3 -9
  64. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +2 -1
  65. package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +3 -2
  66. package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +3 -2
  67. package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +3 -2
  68. package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +3 -2
  69. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +4 -2
  70. package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +3 -2
  71. package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +3 -2
  72. package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +3 -2
  73. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +14 -2
  74. package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +17 -0
  75. package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +6 -3
  76. package/dist/Editor/common/RnD/Utils/gridDropItem.js +5 -4
  77. package/dist/Editor/common/RnD/Utils/index.js +40 -0
  78. package/dist/Editor/common/RnD/index.js +23 -3
  79. package/dist/Editor/common/Shorthands/elements.js +54 -0
  80. package/dist/Editor/common/StyleBuilder/buttonStyle.js +4 -2
  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 +10 -2
  85. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +35 -11
  86. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +13 -4
  87. package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +3 -1
  88. package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +79 -0
  89. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +15 -7
  90. package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +4 -0
  91. package/dist/Editor/common/Uploader.js +8 -0
  92. package/dist/Editor/commonStyle.js +58 -63
  93. package/dist/Editor/helper/deserialize/index.js +1 -1
  94. package/dist/Editor/helper/ensureWrappedVariables.js +28 -0
  95. package/dist/Editor/helper/index.js +2 -2
  96. package/dist/Editor/helper/theme.js +224 -3
  97. package/dist/Editor/hooks/useEditorTheme.js +153 -0
  98. package/dist/Editor/hooks/useMouseMove.js +13 -5
  99. package/dist/Editor/plugins/withEmbeds.js +1 -1
  100. package/dist/Editor/plugins/withHTML.js +2 -2
  101. package/dist/Editor/plugins/withLayout.js +1 -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 +144 -0
  105. package/dist/Editor/themeSettings/ActiveTheme.js +72 -0
  106. package/dist/Editor/themeSettings/buttons/index.js +283 -0
  107. package/dist/Editor/themeSettings/buttons/style.js +21 -0
  108. package/dist/Editor/themeSettings/colorTheme/index.js +292 -0
  109. package/dist/Editor/themeSettings/colorTheme/style.js +77 -0
  110. package/dist/Editor/themeSettings/fonts/PreviewElement.js +121 -0
  111. package/dist/Editor/themeSettings/fonts/index.js +220 -0
  112. package/dist/Editor/themeSettings/fonts/style.js +44 -0
  113. package/dist/Editor/themeSettings/icons.js +60 -0
  114. package/dist/Editor/themeSettings/index.js +320 -0
  115. package/dist/Editor/themeSettings/style.js +152 -0
  116. package/dist/Editor/themeSettingsAI/icons.js +96 -0
  117. package/dist/Editor/themeSettingsAI/index.js +356 -0
  118. package/dist/Editor/themeSettingsAI/saveTheme.js +197 -0
  119. package/dist/Editor/themeSettingsAI/style.js +250 -0
  120. package/dist/Editor/utils/SlateUtilityFunctions.js +161 -42
  121. package/dist/Editor/utils/button.js +0 -14
  122. package/dist/Editor/utils/customHooks/useTableResize.js +2 -1
  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 +88 -19
  126. package/dist/Editor/utils/link.js +1 -1
  127. package/dist/Editor/utils/pageSettings.js +14 -2
  128. package/dist/Editor/utils/table.js +21 -0
  129. package/package.json +5 -2
@@ -1,6 +1,6 @@
1
- import React, { useCallback, useMemo, useRef, useState, useEffect, useImperativeHandle, forwardRef } from "react";
2
- import { Editable, Slate, ReactEditor } from 'slate-react';
3
- import { createEditor, Transforms, Editor } from 'slate';
1
+ import React, { useCallback, useMemo, useRef, useState, useImperativeHandle, forwardRef } from "react";
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";
@@ -35,13 +35,13 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
35
35
  const classes = usePopupStyle(theme);
36
36
  const convertedContent = draftToSlate({
37
37
  data: content && content?.length > 0 ? content : [{
38
- type: 'paragraph',
38
+ type: "paragraph",
39
39
  children: [{
40
- text: ''
40
+ text: ""
41
41
  }]
42
42
  }]
43
43
  });
44
- const [value, setValue] = useState(convertedContent);
44
+ const [value] = useState(convertedContent);
45
45
  const debouncedValue = useRef(value);
46
46
  const debounced = useDebouncedCallback(
47
47
  // function
@@ -216,7 +216,7 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
216
216
  editor
217
217
  });
218
218
  } else if (event.key === "Enter" && !isMobile) {
219
- const isEmpty = debouncedValue?.current.length === 1 && debouncedValue?.current[0].type === 'paragraph' && debouncedValue?.current[0].children.length === 1 && debouncedValue?.current[0].children[0].text === '';
219
+ const isEmpty = debouncedValue?.current.length === 1 && debouncedValue?.current[0].type === "paragraph" && debouncedValue?.current[0].children.length === 1 && debouncedValue?.current[0].children[0].text === "";
220
220
  if (isEmpty) {
221
221
  event.preventDefault();
222
222
  return;
@@ -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 PropTypes from "prop-types";
4
4
  import { createEditor, Range, Transforms } from "slate";
5
5
  import { Slate, Editable, ReactEditor } from "slate-react";
@@ -17,7 +17,7 @@ import { serializeToText } from "./utils/serializeToText";
17
17
  import { getPageSettings } from "./utils/pageSettings";
18
18
  import { getThumbnailImage, invertColor } 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 { getTRBLBreakPoints } from "./helper/theme";
29
+ import { getTRBLBreakPoints, getVariableValue, getBreakpointLineSpacing } from "./helper/theme";
30
30
  import { getInitialValue, handleInsertLastElement, 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,8 +40,10 @@ 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 { jsx as _jsx } from "react/jsx-runtime";
41
45
  import { jsxs as _jsxs } from "react/jsx-runtime";
46
+ export const ThemeContext = /*#__PURE__*/createContext(null);
42
47
  const Item = /*#__PURE__*/forwardRef(({
43
48
  children,
44
49
  ...props
@@ -75,10 +80,10 @@ const Leaf = /*#__PURE__*/React.memo(({
75
80
  });
76
81
  Leaf.displayName = "Leaf";
77
82
  const updateTopBanner = (content = [], setTopBanner) => {
78
- setTopBanner(() => {
79
- const firstNode = content ? content[0] : {};
80
- return firstNode?.type === "topbanner" ? firstNode : null;
81
- });
83
+ // setTopBanner(() => {
84
+ // const firstNode = content ? content[0] : {};
85
+ // return firstNode?.type === "topbanner" ? firstNode : null;
86
+ // });
82
87
  };
83
88
  const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
84
89
  const {
@@ -93,12 +98,14 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
93
98
  otherProps,
94
99
  isIframe,
95
100
  theme,
101
+ showThemeButtons,
96
102
  showViewport = false
97
103
  } = props;
98
104
  const editorWrapper = useRef();
99
105
  const mentionsRef = useRef();
100
106
  const convertedContent = draftToSlate({
101
- data: content
107
+ data: content,
108
+ needLayout: otherProps?.needLayout
102
109
  });
103
110
  const [value, setValue] = useState(convertedContent);
104
111
  const [isInteracted, setIsInteracted] = useState(false);
@@ -138,10 +145,12 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
138
145
  const {
139
146
  bannerSpacing,
140
147
  pageBgImage,
141
- pageColor,
148
+ pageColor = "",
142
149
  color: pageTextColor,
143
150
  pageWidth,
144
- maxWidth: pageMaxWidth
151
+ maxWidth: pageMaxWidth,
152
+ theme: selectedTheme,
153
+ lineHeight
145
154
  } = pageSt?.pageProps || {
146
155
  bannerSpacing: {
147
156
  left: 0,
@@ -152,9 +161,16 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
152
161
  };
153
162
  const classes = editorStyles({
154
163
  padHeight: !fullScreen ? otherProps?.padHeight : 20,
155
- placeHolderColor: invertColor(pageColor || "#FFF"),
164
+ placeHolderColor: invertColor(pageColor.startsWith("var") ? getVariableValue(pageColor) : pageColor || "#FFF"),
156
165
  theme
157
166
  });
167
+ const [openTheme, setOpenTheme] = useState(false);
168
+ const [openAITheme, setOpenAITheme] = useState(false);
169
+ const [, setThemeUpdated] = useState(0);
170
+ const triggerRender = () => {
171
+ setThemeUpdated(prev => prev + 1); // Incrementing forces a re-render while updating theme
172
+ };
173
+
158
174
  const isMobile = window.matchMedia("(max-width: 899px)")?.matches || false;
159
175
  useEffect(() => {
160
176
  setValue(draftToSlate({
@@ -168,11 +184,11 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
168
184
  const debounced = useDebouncedCallback(
169
185
  // function
170
186
  value => {
187
+ debouncedValue.current = value;
171
188
  const {
172
189
  value: strVal,
173
190
  ...restVal
174
191
  } = getOnSaveData(value);
175
- debouncedValue.current = value;
176
192
  onSave(strVal, restVal);
177
193
  },
178
194
  // delay in ms
@@ -183,7 +199,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
183
199
  return {
184
200
  value: JSON.stringify(val),
185
201
  text: text,
186
- title: serializeToText(title?.children) || "Untitled"
202
+ title: serializeToText(title?.children) || ""
187
203
  };
188
204
  };
189
205
  const getPreviewImage = async (needBackground = false, options = {}) => {
@@ -282,6 +298,12 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
282
298
  redo() {
283
299
  editor?.redo();
284
300
  },
301
+ toggleTheme() {
302
+ setOpenTheme(!openTheme);
303
+ },
304
+ toggleAITheme() {
305
+ setOpenAITheme(!openAITheme);
306
+ },
285
307
  getPageSettings: {
286
308
  background: pageBgImage && pageBgImage !== "none" ? `url(${pageBgImage})` : pageColor || ""
287
309
  }
@@ -332,6 +354,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
332
354
  onDrawerOpen: onDrawerOpen,
333
355
  ICON_API: "https://assets.agenciflow.com"
334
356
  };
357
+ const lineH = getBreakpointLineSpacing(lineHeight, breakpoint);
335
358
  const renderElement = useCallback(props => {
336
359
  return /*#__PURE__*/_jsx(Element, {
337
360
  ...props,
@@ -456,6 +479,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
456
479
  }
457
480
  return style;
458
481
  }, [pageBgImage, pageColor]);
482
+ const themeProps = getTheme(selectedTheme);
459
483
 
460
484
  // const handleContextMenu = (e) => {
461
485
  // if (!readOnly) {
@@ -485,15 +509,38 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
485
509
  console.log("handleCursorScroll", err);
486
510
  }
487
511
  };
488
- return /*#__PURE__*/_jsx(EditorProvider, {
512
+ return /*#__PURE__*/_jsxs(EditorProvider, {
489
513
  theme: theme,
490
514
  editor: editor,
491
- children: /*#__PURE__*/_jsx(DialogWrapper, {
515
+ openTheme: openTheme,
516
+ setOpenTheme: setOpenTheme,
517
+ triggerRender: triggerRender,
518
+ children: [showThemeButtons ? /*#__PURE__*/_jsxs("div", {
519
+ style: {
520
+ display: "flex",
521
+ justifyContent: "end",
522
+ alignItems: "center",
523
+ gap: "8px",
524
+ width: "70vw",
525
+ margin: "auto"
526
+ },
527
+ children: [/*#__PURE__*/_jsx(IconButton, {
528
+ onClick: () => setOpenTheme(true),
529
+ children: /*#__PURE__*/_jsx(ThemePaintIcon, {})
530
+ }), /*#__PURE__*/_jsx(IconButton, {
531
+ onClick: () => setOpenAITheme(true),
532
+ style: {
533
+ marginTop: "4px"
534
+ },
535
+ children: /*#__PURE__*/_jsx(ThemeAIIcon, {})
536
+ })]
537
+ }) : null, /*#__PURE__*/_jsx(DialogWrapper, {
492
538
  classes: classes,
493
539
  ...props,
494
540
  fullScreen: fullScreen,
495
541
  footer: footer || "",
496
- children: /*#__PURE__*/_jsxs(Box, {
542
+ selectedTheme: selectedTheme,
543
+ children: /*#__PURE__*/_jsx(Box, {
497
544
  component: "div",
498
545
  className: `et-wrpr stimulate-${breakpoint} ${editorClass || ""} ${isIframe ? "iframe-editor" : ""}`,
499
546
  sx: classes.root,
@@ -503,7 +550,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
503
550
  "data-breakpoint": breakpoint
504
551
  // onContextMenu={handleContextMenu}
505
552
  ,
506
- children: [/*#__PURE__*/_jsxs(Slate, {
553
+ children: /*#__PURE__*/_jsxs(Slate, {
507
554
  editor: editor,
508
555
  initialValue: getInitialValue(debouncedValue?.current, readOnly),
509
556
  onChange: handleEditorChange,
@@ -522,6 +569,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
522
569
  children: /*#__PURE__*/_jsxs(Box, {
523
570
  component: "div",
524
571
  className: "max-content",
572
+ sx: themeProps?.sxProps || {},
525
573
  "data-info": outsideEditorClickLabel,
526
574
  children: [renderTopBanner(), /*#__PURE__*/_jsx("div", {
527
575
  className: "scroll-area",
@@ -534,6 +582,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
534
582
  padding: {
535
583
  ...getTRBLBreakPoints(bannerSpacing)
536
584
  },
585
+ lineHeight: lineH,
537
586
  width: !pageWidth || pageWidth === "fixed" ? fixedWidth : fullWidth,
538
587
  height: viewport.h ? `${viewport.h}px` : `100%`,
539
588
  alignSelf: "center",
@@ -587,6 +636,15 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
587
636
  "data-info": outsideEditorClickLabel,
588
637
  onClick: handleFooterClick,
589
638
  children: footer
639
+ }), openTheme ? /*#__PURE__*/_jsx(ThemeSettings, {
640
+ open: openTheme,
641
+ setOpen: setOpenTheme,
642
+ editor: editor,
643
+ services: otherProps?.services
644
+ }) : null, /*#__PURE__*/_jsx(ThemeSettingsAI, {
645
+ openAITheme: openAITheme,
646
+ setOpenAITheme: setOpenAITheme,
647
+ onSaveTheme: otherProps?.onSaveTheme
590
648
  })]
591
649
  })
592
650
  }), !readOnly ? /*#__PURE__*/_jsx(PopupTool, {
@@ -595,23 +653,21 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
595
653
  setIsTextSelected: setIsTextSelected,
596
654
  customProps: customProps,
597
655
  editorWrapper: editorWrapper
598
- }) : null, !readOnly && showViewport ? /*#__PURE__*/_jsx(SwitchViewport, {
656
+ }) : null, !readOnly ? /*#__PURE__*/_jsx(SwitchViewport, {
599
657
  breakpoint: breakpoint,
658
+ show: showViewport,
600
659
  onChange: b => onSwitchBreakpoint(b)
601
660
  }) : null]
602
661
  })
603
662
  }), htmlAction.showInput && /*#__PURE__*/_jsx(CodeToText, {
604
663
  ...htmlAction,
605
664
  handleCodeToText: handleCodeToText
665
+ }), /*#__PURE__*/_jsx(FontLoader, {
666
+ ...props
606
667
  })]
607
- }, id), /*#__PURE__*/_jsx(FontLoader, {
608
- otherProps: {
609
- services: otherProps?.services
610
- },
611
- readOnly: readOnly
612
- })]
668
+ }, id)
613
669
  })
614
- })
670
+ })]
615
671
  });
616
672
  });
617
673
  CommonEditor.displayName = "CommonEditor";
@@ -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
  };
@@ -995,7 +995,7 @@ blockquote {
995
995
 
996
996
  .sliderInput {
997
997
  width: 66px !important;
998
- padding: 2px 10px;
998
+ padding: 2px 0px 2px 4px;
999
999
  margin-left: 18px;
1000
1000
  box-shadow: 0px 4px 16px 0px #0000000d;
1001
1001
  border: 1px solid #6f6f6f33;
@@ -1263,6 +1263,19 @@ blockquote {
1263
1263
  pointer-events: auto;
1264
1264
  }
1265
1265
 
1266
+ @media (max-width: 899px) {
1267
+ .MuiPopover-root {
1268
+ z-index: 1302 !important;
1269
+ }
1270
+ canvas {
1271
+ max-width: 100% !important;
1272
+ }
1273
+ }
1274
+
1275
+ .settingsHeader {
1276
+ font-size: 14px !important;
1277
+ font-weight: 500 !important;
1278
+ }
1266
1279
  .hideScroll {
1267
1280
  overflow-anchor: none;
1268
1281
  }
@@ -1278,20 +1291,6 @@ blockquote {
1278
1291
  .hideScroll::-webkit-scrollbar-thumb:hover {
1279
1292
  background: none !important;
1280
1293
  }
1281
- @media (max-width: 899px) {
1282
- .MuiPopover-root {
1283
- z-index: 1302 !important;
1284
- }
1285
-
1286
- canvas {
1287
- max-width: 100% !important;
1288
- }
1289
- }
1290
-
1291
- .settingsHeader {
1292
- font-size: 14px !important;
1293
- font-weight: 500 !important;
1294
- }
1295
1294
 
1296
1295
  .custom-scroll::-webkit-scrollbar {
1297
1296
  height: .6rem;
@@ -1338,4 +1337,11 @@ code.markcode {
1338
1337
  display: block;
1339
1338
  background-color: #f3f3f3;
1340
1339
  font-family: 'Source Code Pro' !important;
1341
- }
1340
+ }
1341
+
1342
+ /* Hide the popper when the reference is hidden */
1343
+ .hide-popper-on-overlap[data-popper-escaped],
1344
+ .hide-popper-on-overlap[data-popper-reference-hidden] {
1345
+ visibility: hidden;
1346
+ pointer-events: none;
1347
+ }
@@ -6,7 +6,7 @@ import AIInput from "./AIInput";
6
6
  import { ReactEditor, useSlate } from "slate-react";
7
7
  import { Node, Range, Transforms } from "slate";
8
8
  import { MODES } from "./helper";
9
- import { getSelectedText, getSlateDom } from "../../utils/helper";
9
+ import { getSelectedText, getSlateDom, viewSlateSelection } from "../../utils/helper";
10
10
  import { VoiceToText } from "./VoiceToText";
11
11
  import deserialize from "../../helper/deserialize";
12
12
  import useEditorScroll from "../../hooks/useEditorScroll";
@@ -286,17 +286,7 @@ function PopoverAIInput({
286
286
  };
287
287
  useEffect(() => {
288
288
  if (openAI && getSelectedText(editor).trim()) {
289
- const customSelection = document.querySelectorAll(".slate-highlight");
290
- const selectionBg = "rgba(35, 131, 226, 0.35)";
291
- if (customSelection?.length) {
292
- customSelection?.forEach(el => el.style.background = selectionBg);
293
-
294
- // if ai is opened, remove the window selection class and open then slate selection, To resolve: focussing on the ai input removes window selection automatically
295
- const selection = window.getSelection();
296
- if (selection) {
297
- selection.removeAllRanges(); // Clears the selection
298
- }
299
- }
289
+ viewSlateSelection();
300
290
  }
301
291
  }, [editor.selection, openAI]);
302
292
  return /*#__PURE__*/_jsxs("div", {
@@ -265,7 +265,7 @@ function AppHeader(props) {
265
265
  style: {
266
266
  display: "inline-flex",
267
267
  alignItems: "center",
268
- color: textColor,
268
+ color: textColor || "#000000",
269
269
  fontSize: logoFontSize,
270
270
  fontFamily: titleFontFamily,
271
271
  justifyContent: isLogoRight ? "end" : "start"
@@ -320,7 +320,7 @@ function AppHeader(props) {
320
320
  fontFamily: fontFamily,
321
321
  textTransform: "none",
322
322
  fontSize: fontSize || "16px",
323
- color: textColor || "#FFF",
323
+ color: textColor || "#000",
324
324
  background: bgColor || "none",
325
325
  "& .m-settings": {
326
326
  display: "none",
@@ -335,7 +335,7 @@ function AppHeader(props) {
335
335
  background: "#FFF"
336
336
  },
337
337
  "&:hover": {
338
- color: textColorHover || textColor || "#FFF",
338
+ color: textColorHover || textColor || "#000",
339
339
  background: bgColorHover || bgColor || "none",
340
340
  "& .m-settings": {
341
341
  display: "block"
@@ -9,6 +9,8 @@ import { WorkflowIcon } from "../../common/iconslist";
9
9
  import { getTRBLBreakPoints, getBreakPointsValue, groupByBreakpoint } from "../../helper/theme";
10
10
  import { handleLinkType, windowVar } from "../../utils/helper";
11
11
  import LinkSettings from "../../common/LinkSettings";
12
+ import { useEditorTheme } from "../../hooks/useEditorTheme";
13
+ import { getTheme } from "../../theme";
12
14
  import Icon from "../../common/Icon";
13
15
  import { useEditorContext } from "../../hooks/useMouseMove";
14
16
  import useCommonStyle from "../../commonStyle";
@@ -38,6 +40,12 @@ const EditorButton = props => {
38
40
  const [openNav, setOpenNav] = useState(false);
39
41
  const [openMoreOptions, setOpenMoreOptions] = useState(false);
40
42
  const classes = useCommonStyle(appTheme);
43
+ const {
44
+ theme: selectedTheme
45
+ } = useEditorTheme();
46
+ const {
47
+ buttonTheme
48
+ } = getTheme(selectedTheme);
41
49
  const {
42
50
  label,
43
51
  bgColor,
@@ -51,7 +59,7 @@ const EditorButton = props => {
51
59
  fontFamily,
52
60
  textColorHover,
53
61
  bgColorHover,
54
- buttonIcon,
62
+ // buttonIcon,
55
63
  iconPosition = "start",
56
64
  borderStyle,
57
65
  borderWidth,
@@ -72,6 +80,7 @@ const EditorButton = props => {
72
80
  };
73
81
  const isTrigger = linkType === "nextTrigger" || linkType === "prevTrigger";
74
82
  const refURl = isTrigger ? buttonLink?.url : url;
83
+ const buttonIcon = element?.buttonIcon || buttonTheme?.buttonIcon;
75
84
  const BtnIcon = buttonIcon ? buttonIcon : null;
76
85
  windowVar.lastButtonProps = element;
77
86
  const handleTrigger = async () => {
@@ -162,6 +171,7 @@ const EditorButton = props => {
162
171
  display: "inline-flex",
163
172
  color: "rgba(0, 0, 0, 0.54)",
164
173
  marginBottom: "0px !important",
174
+ ...classes.buttonMoreOption,
165
175
  ...classes.buttonMoreOption3
166
176
  },
167
177
  ...btnProps,
@@ -253,31 +263,38 @@ const EditorButton = props => {
253
263
  display: "inline-block"
254
264
  },
255
265
  children: [/*#__PURE__*/_jsxs(Box, {
266
+ className: `btn textAlign-${tAlign} button theme-element`,
256
267
  ref: buttonRef,
257
- className: `btn textAlign-${tAlign}`,
258
268
  sx: {
259
269
  textDecoration: "none",
260
- background: bgColor || "rgb(30, 75, 122)",
261
270
  borderBlockStyle: "solid",
262
- borderColor: borderColor || "transparent",
263
271
  borderWidth: borderWidth !== undefined ? borderWidth : borderColor ? "1px" : "0px",
264
272
  ...btnSp,
265
273
  borderStyle: borderStyle || "solid",
266
- color: `${textColor || "#FFFFFF"}`,
267
- fontSize: textSize || "inherit",
268
- fontFamily: fontFamily || "PoppinsRegular",
269
274
  display: "inline-flex",
270
275
  alignItems: "center",
271
276
  position: "relative",
277
+ lineHeight: 1.43,
272
278
  "& .element-toolbar": {
273
279
  display: "none"
274
280
  },
275
281
  "&:hover": {
276
- color: `${textColorHover || textColor || "#FFFFFF"}`,
277
- background: bgColorHover || bgColor || "rgb(30, 75, 122)",
282
+ color: `${textColorHover || textColor}`,
283
+ background: bgColorHover || bgColor,
278
284
  "& .element-toolbar": {
279
285
  display: "flex"
280
286
  }
287
+ },
288
+ color: textColor ? `${textColor} !important` : "#FFFFFF",
289
+ fontSize: textSize ? `${textSize}px !important` : "inherit",
290
+ fontFamily: fontFamily ? `${fontFamily} !important` : "PoppinsRegular",
291
+ background: `${bgColor} !important`,
292
+ borderColor: `${borderColor} !important`,
293
+ borderRadius: {
294
+ ...getBreakPointsValue(borderRadius || buttonTheme?.borderRadius || {}, null, "overrideBorderRadius", true)
295
+ },
296
+ padding: {
297
+ ...getTRBLBreakPoints(bannerSpacing || buttonTheme?.bannerSpacing || {})
281
298
  }
282
299
  },
283
300
  ...buttonProps,