@flozy/editor 7.0.6 → 7.0.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.
- package/dist/Editor/ChatEditor.js +7 -7
- package/dist/Editor/CommonEditor.js +74 -25
- package/dist/Editor/DialogWrapper.js +31 -25
- package/dist/Editor/Editor.css +32 -16
- package/dist/Editor/Elements/AppHeader/AppHeader.js +3 -3
- package/dist/Editor/Elements/Button/EditorButton.js +25 -9
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +57 -12
- package/dist/Editor/Elements/Color Picker/ColorPicker.css +25 -1
- package/dist/Editor/Elements/Color Picker/ColorPicker.js +4 -4
- package/dist/Editor/Elements/Color Picker/Styles.js +1 -1
- package/dist/Editor/Elements/DataView/Providers/DataViewProvider.js +1 -1
- package/dist/Editor/Elements/Embed/Image.js +2 -2
- package/dist/Editor/Elements/FreeGrid/FreeGrid.js +0 -14
- package/dist/Editor/Elements/FreeGrid/styles.js +3 -0
- package/dist/Editor/Elements/Grid/GridItem.js +2 -3
- package/dist/Editor/Elements/Link/Link.js +70 -43
- package/dist/Editor/Elements/SimpleText/index.js +7 -12
- package/dist/Editor/Elements/SimpleText/style.js +2 -2
- package/dist/Editor/Elements/Table/Table.js +12 -12
- package/dist/Editor/Elements/Title/title.js +13 -1
- package/dist/Editor/Elements/Variables/Style.js +28 -2
- package/dist/Editor/Elements/Variables/VariableButton.js +17 -4
- package/dist/Editor/Styles/EditorStyles.js +287 -291
- package/dist/Editor/Toolbar/FormatTools/Dropdown.js +27 -3
- package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +4 -3
- package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
- package/dist/Editor/Toolbar/FormatTools/TextSize.js +7 -15
- package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +9 -8
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +6 -13
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +210 -85
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +2 -1
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +16 -12
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +56 -9
- package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +438 -0
- package/dist/Editor/Toolbar/PopupTool/index.js +32 -55
- package/dist/Editor/Toolbar/toolbarGroups.js +48 -6
- package/dist/Editor/assets/svg/ThemeIcons.js +291 -0
- package/dist/Editor/common/ColorPickerButton.js +35 -9
- package/dist/Editor/common/CustomColorPicker/index.js +106 -0
- package/dist/Editor/common/CustomColorPicker/style.js +53 -0
- package/dist/Editor/common/CustomDialog/index.js +94 -0
- package/dist/Editor/common/CustomDialog/style.js +67 -0
- package/dist/Editor/common/CustomSelect.js +33 -0
- package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
- package/dist/Editor/common/DnD/Draggable.js +0 -1
- package/dist/Editor/common/FontLoader/FontList.js +3 -11
- package/dist/Editor/common/FontLoader/FontLoader.js +74 -42
- package/dist/Editor/common/Icon.js +28 -0
- package/dist/Editor/common/ImageSelector/Options/Upload.js +1 -1
- package/dist/Editor/common/ImageSelector/Styles.js +3 -9
- package/dist/Editor/common/ImageSelector/UploadStyles.js +1 -2
- package/dist/Editor/common/MentionsPopup/Styles.js +3 -9
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +2 -1
- package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +4 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/styles.js +0 -1
- package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +8 -2
- package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +17 -0
- package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +6 -3
- package/dist/Editor/common/RnD/Utils/gridDropItem.js +5 -4
- package/dist/Editor/common/RnD/Utils/index.js +40 -0
- package/dist/Editor/common/RnD/index.js +23 -3
- package/dist/Editor/common/Section/index.js +60 -89
- package/dist/Editor/common/Shorthands/elements.js +54 -0
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +4 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +5 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +12 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +15 -7
- package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +10 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +35 -11
- package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +13 -4
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +15 -7
- package/dist/Editor/common/Uploader.js +8 -0
- package/dist/Editor/commonStyle.js +55 -65
- package/dist/Editor/helper/deserialize/index.js +1 -1
- package/dist/Editor/helper/index.js +2 -2
- package/dist/Editor/helper/theme.js +200 -2
- package/dist/Editor/hooks/useDrag.js +17 -11
- package/dist/Editor/hooks/useEditorScroll.js +1 -2
- package/dist/Editor/hooks/useEditorTheme.js +153 -0
- package/dist/Editor/hooks/useMouseMove.js +9 -3
- package/dist/Editor/plugins/withEmbeds.js +1 -1
- package/dist/Editor/plugins/withHTML.js +5 -9
- package/dist/Editor/plugins/withLayout.js +1 -1
- package/dist/Editor/plugins/withTable.js +1 -1
- package/dist/Editor/theme/ThemeList.js +50 -173
- package/dist/Editor/theme/index.js +144 -0
- package/dist/Editor/themeSettings/ActiveTheme.js +72 -0
- package/dist/Editor/themeSettings/buttons/index.js +283 -0
- package/dist/Editor/themeSettings/buttons/style.js +21 -0
- package/dist/Editor/themeSettings/colorTheme/index.js +292 -0
- package/dist/Editor/themeSettings/colorTheme/style.js +77 -0
- package/dist/Editor/themeSettings/fonts/PreviewElement.js +121 -0
- package/dist/Editor/themeSettings/fonts/index.js +220 -0
- package/dist/Editor/themeSettings/fonts/style.js +44 -0
- package/dist/Editor/themeSettings/icons.js +60 -0
- package/dist/Editor/themeSettings/index.js +320 -0
- package/dist/Editor/themeSettings/style.js +152 -0
- package/dist/Editor/themeSettingsAI/icons.js +96 -0
- package/dist/Editor/themeSettingsAI/index.js +356 -0
- package/dist/Editor/themeSettingsAI/saveTheme.js +197 -0
- package/dist/Editor/themeSettingsAI/style.js +250 -0
- package/dist/Editor/utils/SlateUtilityFunctions.js +157 -49
- package/dist/Editor/utils/button.js +0 -14
- package/dist/Editor/utils/draftToSlate.js +3 -2
- package/dist/Editor/utils/font.js +40 -37
- package/dist/Editor/utils/helper.js +48 -20
- package/dist/Editor/utils/link.js +1 -1
- package/package.json +6 -3
@@ -1,6 +1,6 @@
|
|
1
|
-
import React, { useCallback, useMemo, useRef, useState,
|
2
|
-
import { Editable, Slate, ReactEditor } from
|
3
|
-
import { createEditor, Transforms, Editor } from
|
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:
|
38
|
+
type: "paragraph",
|
39
39
|
children: [{
|
40
|
-
text:
|
40
|
+
text: ""
|
41
41
|
}]
|
42
42
|
}]
|
43
43
|
});
|
44
|
-
const [value
|
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 ===
|
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 {
|
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
|
@@ -54,13 +59,14 @@ const Item = /*#__PURE__*/forwardRef(({
|
|
54
59
|
});
|
55
60
|
});
|
56
61
|
Item.displayName = "Item";
|
57
|
-
const Element = props => {
|
62
|
+
const Element = /*#__PURE__*/React.memo(props => {
|
58
63
|
return /*#__PURE__*/_jsx(Section, {
|
59
64
|
...props,
|
60
65
|
children: getBlock(props)
|
61
66
|
});
|
62
|
-
};
|
63
|
-
|
67
|
+
});
|
68
|
+
Element.displayName = "Element";
|
69
|
+
const Leaf = /*#__PURE__*/React.memo(({
|
64
70
|
attributes,
|
65
71
|
children,
|
66
72
|
leaf
|
@@ -71,12 +77,13 @@ const Leaf = ({
|
|
71
77
|
...attributes,
|
72
78
|
children: children
|
73
79
|
});
|
74
|
-
};
|
80
|
+
});
|
81
|
+
Leaf.displayName = "Leaf";
|
75
82
|
const updateTopBanner = (content = [], setTopBanner) => {
|
76
|
-
setTopBanner(() => {
|
77
|
-
|
78
|
-
|
79
|
-
});
|
83
|
+
// setTopBanner(() => {
|
84
|
+
// const firstNode = content ? content[0] : {};
|
85
|
+
// return firstNode?.type === "topbanner" ? firstNode : null;
|
86
|
+
// });
|
80
87
|
};
|
81
88
|
const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
82
89
|
const {
|
@@ -91,13 +98,14 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
91
98
|
otherProps,
|
92
99
|
isIframe,
|
93
100
|
theme,
|
94
|
-
|
95
|
-
|
101
|
+
showThemeButtons,
|
102
|
+
showViewport = false
|
96
103
|
} = props;
|
97
104
|
const editorWrapper = useRef();
|
98
105
|
const mentionsRef = useRef();
|
99
106
|
const convertedContent = draftToSlate({
|
100
|
-
data: content
|
107
|
+
data: content,
|
108
|
+
needLayout: otherProps?.needLayout
|
101
109
|
});
|
102
110
|
const [value, setValue] = useState(convertedContent);
|
103
111
|
const [isInteracted, setIsInteracted] = useState(false);
|
@@ -137,10 +145,11 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
137
145
|
const {
|
138
146
|
bannerSpacing,
|
139
147
|
pageBgImage,
|
140
|
-
pageColor,
|
148
|
+
pageColor = "",
|
141
149
|
color: pageTextColor,
|
142
150
|
pageWidth,
|
143
151
|
maxWidth: pageMaxWidth,
|
152
|
+
theme: selectedTheme,
|
144
153
|
lineHeight
|
145
154
|
} = pageSt?.pageProps || {
|
146
155
|
bannerSpacing: {
|
@@ -152,10 +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"),
|
156
|
-
theme
|
157
|
-
overrideWrapperStyles
|
164
|
+
placeHolderColor: invertColor(pageColor.startsWith("var") ? getVariableValue(pageColor) : pageColor || "#FFF"),
|
165
|
+
theme
|
158
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
|
+
|
159
174
|
const isMobile = window.matchMedia("(max-width: 899px)")?.matches || false;
|
160
175
|
useEffect(() => {
|
161
176
|
setValue(draftToSlate({
|
@@ -169,11 +184,11 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
169
184
|
const debounced = useDebouncedCallback(
|
170
185
|
// function
|
171
186
|
value => {
|
187
|
+
debouncedValue.current = value;
|
172
188
|
const {
|
173
189
|
value: strVal,
|
174
190
|
...restVal
|
175
191
|
} = getOnSaveData(value);
|
176
|
-
debouncedValue.current = value;
|
177
192
|
onSave(strVal, restVal);
|
178
193
|
},
|
179
194
|
// delay in ms
|
@@ -184,7 +199,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
184
199
|
return {
|
185
200
|
value: JSON.stringify(val),
|
186
201
|
text: text,
|
187
|
-
title: serializeToText(title?.children) || "
|
202
|
+
title: serializeToText(title?.children) || ""
|
188
203
|
};
|
189
204
|
};
|
190
205
|
const getPreviewImage = async (needBackground = false, options = {}) => {
|
@@ -283,6 +298,12 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
283
298
|
redo() {
|
284
299
|
editor?.redo();
|
285
300
|
},
|
301
|
+
toggleTheme() {
|
302
|
+
setOpenTheme(!openTheme);
|
303
|
+
},
|
304
|
+
toggleAITheme() {
|
305
|
+
setOpenAITheme(!openAITheme);
|
306
|
+
},
|
286
307
|
getPageSettings: {
|
287
308
|
background: pageBgImage && pageBgImage !== "none" ? `url(${pageBgImage})` : pageColor || ""
|
288
309
|
}
|
@@ -314,7 +335,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
314
335
|
updateTopBanner(newValue, setTopBanner);
|
315
336
|
debounced(newValue);
|
316
337
|
if (!isInteracted) {
|
317
|
-
setIsInteracted(true);
|
338
|
+
// setIsInteracted(true);
|
318
339
|
}
|
319
340
|
}
|
320
341
|
};
|
@@ -458,6 +479,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
458
479
|
}
|
459
480
|
return style;
|
460
481
|
}, [pageBgImage, pageColor]);
|
482
|
+
const themeProps = getTheme(selectedTheme);
|
461
483
|
|
462
484
|
// const handleContextMenu = (e) => {
|
463
485
|
// if (!readOnly) {
|
@@ -487,14 +509,30 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
487
509
|
console.log("handleCursorScroll", err);
|
488
510
|
}
|
489
511
|
};
|
490
|
-
return /*#__PURE__*/
|
512
|
+
return /*#__PURE__*/_jsxs(EditorProvider, {
|
491
513
|
theme: theme,
|
492
514
|
editor: editor,
|
493
|
-
|
515
|
+
openTheme: openTheme,
|
516
|
+
setOpenTheme: setOpenTheme,
|
517
|
+
triggerRender: triggerRender,
|
518
|
+
children: [showThemeButtons ? /*#__PURE__*/_jsxs("div", {
|
519
|
+
className: "theme-buttons",
|
520
|
+
children: [/*#__PURE__*/_jsx(IconButton, {
|
521
|
+
onClick: () => setOpenTheme(true),
|
522
|
+
children: /*#__PURE__*/_jsx(ThemePaintIcon, {})
|
523
|
+
}), /*#__PURE__*/_jsx(IconButton, {
|
524
|
+
onClick: () => setOpenAITheme(true),
|
525
|
+
style: {
|
526
|
+
marginTop: "4px"
|
527
|
+
},
|
528
|
+
children: /*#__PURE__*/_jsx(ThemeAIIcon, {})
|
529
|
+
})]
|
530
|
+
}) : null, /*#__PURE__*/_jsx(DialogWrapper, {
|
494
531
|
classes: classes,
|
495
532
|
...props,
|
496
533
|
fullScreen: fullScreen,
|
497
534
|
footer: footer || "",
|
535
|
+
selectedTheme: selectedTheme,
|
498
536
|
children: /*#__PURE__*/_jsx(Box, {
|
499
537
|
component: "div",
|
500
538
|
className: `et-wrpr stimulate-${breakpoint} ${editorClass || ""} ${isIframe ? "iframe-editor" : ""}`,
|
@@ -524,6 +562,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
524
562
|
children: /*#__PURE__*/_jsxs(Box, {
|
525
563
|
component: "div",
|
526
564
|
className: "max-content",
|
565
|
+
sx: themeProps?.sxProps || {},
|
527
566
|
"data-info": outsideEditorClickLabel,
|
528
567
|
children: [renderTopBanner(), /*#__PURE__*/_jsx("div", {
|
529
568
|
className: "scroll-area",
|
@@ -590,6 +629,15 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
590
629
|
"data-info": outsideEditorClickLabel,
|
591
630
|
onClick: handleFooterClick,
|
592
631
|
children: footer
|
632
|
+
}), openTheme ? /*#__PURE__*/_jsx(ThemeSettings, {
|
633
|
+
open: openTheme,
|
634
|
+
setOpen: setOpenTheme,
|
635
|
+
editor: editor,
|
636
|
+
services: otherProps?.services
|
637
|
+
}) : null, /*#__PURE__*/_jsx(ThemeSettingsAI, {
|
638
|
+
openAITheme: openAITheme,
|
639
|
+
setOpenAITheme: setOpenAITheme,
|
640
|
+
onSaveTheme: otherProps?.onSaveTheme
|
593
641
|
})]
|
594
642
|
})
|
595
643
|
}), !readOnly ? /*#__PURE__*/_jsx(PopupTool, {
|
@@ -598,8 +646,9 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
598
646
|
setIsTextSelected: setIsTextSelected,
|
599
647
|
customProps: customProps,
|
600
648
|
editorWrapper: editorWrapper
|
601
|
-
}) : null, !readOnly
|
649
|
+
}) : null, !readOnly ? /*#__PURE__*/_jsx(SwitchViewport, {
|
602
650
|
breakpoint: breakpoint,
|
651
|
+
show: showViewport,
|
603
652
|
onChange: b => onSwitchBreakpoint(b)
|
604
653
|
}) : null]
|
605
654
|
})
|
@@ -611,7 +660,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
611
660
|
})]
|
612
661
|
}, id)
|
613
662
|
})
|
614
|
-
})
|
663
|
+
})]
|
615
664
|
});
|
616
665
|
});
|
617
666
|
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__*/
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
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
|
-
|
24
|
+
zIndex: 1000
|
26
25
|
},
|
27
|
-
|
26
|
+
sx: classes.fullScreenWrapper,
|
27
|
+
children: [/*#__PURE__*/_jsx(DialogTitle, {
|
28
|
+
style: {
|
29
|
+
padding: "6px 8px"
|
30
|
+
},
|
28
31
|
children: /*#__PURE__*/_jsx(Grid, {
|
29
|
-
|
30
|
-
display: "flex",
|
31
|
-
justifyContent: "end"
|
32
|
-
},
|
33
|
-
children: /*#__PURE__*/_jsx(IconButton, {
|
34
|
-
onClick: onClose,
|
32
|
+
children: /*#__PURE__*/_jsx(Grid, {
|
35
33
|
style: {
|
36
|
-
|
34
|
+
display: "flex",
|
35
|
+
justifyContent: "end"
|
37
36
|
},
|
38
|
-
children: /*#__PURE__*/_jsx(
|
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
|
-
|
43
|
-
|
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
|
};
|
package/dist/Editor/Editor.css
CHANGED
@@ -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,21 +1291,6 @@ blockquote {
|
|
1278
1291
|
.hideScroll::-webkit-scrollbar-thumb:hover {
|
1279
1292
|
background: none !important;
|
1280
1293
|
}
|
1281
|
-
@media (max-width: 899px) {
|
1282
|
-
/* Qa validation required */
|
1283
|
-
/* .MuiPopover-root {
|
1284
|
-
z-index: 1302 !important;
|
1285
|
-
} */
|
1286
|
-
|
1287
|
-
canvas {
|
1288
|
-
max-width: 100% !important;
|
1289
|
-
}
|
1290
|
-
}
|
1291
|
-
|
1292
|
-
.settingsHeader {
|
1293
|
-
font-size: 14px !important;
|
1294
|
-
font-weight: 500 !important;
|
1295
|
-
}
|
1296
1294
|
|
1297
1295
|
.custom-scroll::-webkit-scrollbar {
|
1298
1296
|
height: .6rem;
|
@@ -1339,4 +1337,22 @@ code.markcode {
|
|
1339
1337
|
display: block;
|
1340
1338
|
background-color: #f3f3f3;
|
1341
1339
|
font-family: 'Source Code Pro' !important;
|
1342
|
-
}
|
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
|
+
}
|
1348
|
+
|
1349
|
+
.theme-buttons {
|
1350
|
+
display: flex;
|
1351
|
+
justify-content: end;
|
1352
|
+
align-items: center;
|
1353
|
+
margin: auto;
|
1354
|
+
position: absolute;
|
1355
|
+
top: 60px;
|
1356
|
+
right: 20px;
|
1357
|
+
z-index: 1000;
|
1358
|
+
}
|
@@ -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 || "#
|
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 || "#
|
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,19 +263,14 @@ 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",
|
@@ -274,11 +279,22 @@ const EditorButton = props => {
|
|
274
279
|
display: "none"
|
275
280
|
},
|
276
281
|
"&:hover": {
|
277
|
-
color: `${textColorHover || textColor
|
278
|
-
background: bgColorHover || bgColor
|
282
|
+
color: `${textColorHover || textColor}`,
|
283
|
+
background: bgColorHover || bgColor,
|
279
284
|
"& .element-toolbar": {
|
280
285
|
display: "flex"
|
281
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 || {})
|
282
298
|
}
|
283
299
|
},
|
284
300
|
...buttonProps,
|
@@ -1,11 +1,15 @@
|
|
1
1
|
import React, { useState } from "react";
|
2
|
-
import { Box, IconButton, Popover } from "@mui/material";
|
2
|
+
import { Box, IconButton, Popover, Typography, useTheme } from "@mui/material";
|
3
3
|
import KeyboardArrowDownRoundedIcon from "@mui/icons-material/KeyboardArrowDownRounded";
|
4
4
|
import Button from "../../common/Button";
|
5
5
|
import { colors } from "./defaultColors";
|
6
6
|
import ColorPicker from "./colorPicker.svg";
|
7
|
+
import { useSlateStatic } from "slate-react";
|
8
|
+
import { Transforms } from "slate";
|
9
|
+
import { useEditorContext } from "../../hooks/useMouseMove";
|
7
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
8
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
12
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
9
13
|
let c = [];
|
10
14
|
const ColorChunks = (recentColors = []) => [...recentColors, ...colors].reduce((a, b, i) => {
|
11
15
|
if (i % 7 === 0) {
|
@@ -110,12 +114,18 @@ const ColorButtons = props => {
|
|
110
114
|
openColorTool,
|
111
115
|
onClose,
|
112
116
|
onColorPickerClick,
|
117
|
+
disableEditTheme,
|
113
118
|
defaultColors = []
|
114
119
|
} = props;
|
115
120
|
const [row1, ...restRows] = ColorChunks([]);
|
116
121
|
const [anchorEl, setAnchorEl] = useState(null);
|
117
122
|
const open = Boolean(anchorEl);
|
118
123
|
const firstRow = defaultColors?.length ? defaultColors : row1;
|
124
|
+
const theme = useTheme();
|
125
|
+
const editor = useSlateStatic();
|
126
|
+
const {
|
127
|
+
setOpenTheme
|
128
|
+
} = useEditorContext();
|
119
129
|
const handleMore = e => {
|
120
130
|
setAnchorEl(e.currentTarget);
|
121
131
|
};
|
@@ -128,6 +138,7 @@ const ColorButtons = props => {
|
|
128
138
|
const handleSelect = color => () => {
|
129
139
|
onSelect(color);
|
130
140
|
};
|
141
|
+
const colorVars = theme?.vars?.colors || {};
|
131
142
|
return /*#__PURE__*/_jsxs(Box, {
|
132
143
|
component: "span",
|
133
144
|
sx: classes.colorButtons,
|
@@ -144,7 +155,7 @@ const ColorButtons = props => {
|
|
144
155
|
activeColor: activeColor
|
145
156
|
}, `si_btn_row1_${m}_${i}`);
|
146
157
|
})
|
147
|
-
}), /*#__PURE__*/
|
158
|
+
}), /*#__PURE__*/_jsx(Popover, {
|
148
159
|
open: open || openColorTool,
|
149
160
|
anchorEl: anchorEl || openColorTool,
|
150
161
|
onClose: handleClose,
|
@@ -158,9 +169,39 @@ const ColorButtons = props => {
|
|
158
169
|
},
|
159
170
|
sx: classes.colorPopper,
|
160
171
|
className: "colorPopper",
|
161
|
-
children:
|
172
|
+
children: /*#__PURE__*/_jsxs(Box, {
|
162
173
|
sx: classes.colorButtonsInner,
|
163
|
-
children:
|
174
|
+
children: [Object.values(colorVars)?.length ? /*#__PURE__*/_jsxs(_Fragment, {
|
175
|
+
children: [/*#__PURE__*/_jsxs(Box, {
|
176
|
+
component: "div",
|
177
|
+
className: "singleColorTitleWrapper",
|
178
|
+
children: [/*#__PURE__*/_jsx(Typography, {
|
179
|
+
variant: "subtitle2",
|
180
|
+
children: "Theme colours"
|
181
|
+
}), disableEditTheme ? null : /*#__PURE__*/_jsx("div", {
|
182
|
+
className: "editBtn",
|
183
|
+
onClick: () => {
|
184
|
+
Transforms.deselect(editor, {
|
185
|
+
at: editor.selection
|
186
|
+
});
|
187
|
+
setOpenTheme("editThemeColor");
|
188
|
+
},
|
189
|
+
children: "Edit"
|
190
|
+
})]
|
191
|
+
}), /*#__PURE__*/_jsx(SingleColorButton, {
|
192
|
+
crs: Object.values(colorVars),
|
193
|
+
handleSelect: handleSelect,
|
194
|
+
classes: classes,
|
195
|
+
activeColor: activeColor
|
196
|
+
})]
|
197
|
+
}) : null, /*#__PURE__*/_jsx(Box, {
|
198
|
+
component: "div",
|
199
|
+
className: "singleColorTitleWrapper",
|
200
|
+
children: /*#__PURE__*/_jsx(Typography, {
|
201
|
+
variant: "subtitle2",
|
202
|
+
children: "Custom colour"
|
203
|
+
})
|
204
|
+
}), restRows.map((m, i) => {
|
164
205
|
return /*#__PURE__*/_jsx(SingleColorButton, {
|
165
206
|
id: `p2_${id}`,
|
166
207
|
crs: m,
|
@@ -169,14 +210,18 @@ const ColorButtons = props => {
|
|
169
210
|
classes: classes,
|
170
211
|
activeColor: activeColor
|
171
212
|
}, `si_btn_${m}_${i}`);
|
172
|
-
})
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
213
|
+
}), forMiniTool ? /*#__PURE__*/_jsx(IconButton, {
|
214
|
+
onClick: onColorPickerClick,
|
215
|
+
style: {
|
216
|
+
alignSelf: "start",
|
217
|
+
margin: "6px"
|
218
|
+
},
|
219
|
+
children: /*#__PURE__*/_jsx("img", {
|
220
|
+
src: ColorPicker,
|
221
|
+
alt: "color wheel"
|
222
|
+
})
|
223
|
+
}) : null]
|
224
|
+
})
|
180
225
|
})]
|
181
226
|
});
|
182
227
|
};
|