@flozy/editor 7.0.7 → 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 +33 -16
- package/dist/Editor/Elements/AI/PopoverAIInput.js +2 -12
- package/dist/Editor/Elements/AppHeader/AppHeader.js +3 -3
- package/dist/Editor/Elements/Button/EditorButton.js +26 -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/DataView.js +4 -3
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/NumberType.js +5 -1
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/TextType.js +5 -1
- package/dist/Editor/Elements/DataView/Layouts/FilterView.js +23 -19
- package/dist/Editor/Elements/DataView/Providers/DataViewProvider.js +1 -1
- package/dist/Editor/Elements/Embed/Image.js +2 -2
- package/dist/Editor/Elements/Form/Form.js +1 -0
- package/dist/Editor/Elements/FreeGrid/FreeGrid.js +0 -14
- package/dist/Editor/Elements/FreeGrid/styles.js +4 -0
- package/dist/Editor/Elements/Grid/GridItem.js +2 -3
- package/dist/Editor/Elements/Link/Link.js +70 -43
- package/dist/Editor/Elements/List/CheckList.js +2 -1
- package/dist/Editor/Elements/Search/SearchAttachment.js +1 -0
- package/dist/Editor/Elements/Search/SearchList.js +8 -1
- package/dist/Editor/Elements/SimpleText/index.js +8 -1
- package/dist/Editor/Elements/SimpleText/style.js +5 -1
- package/dist/Editor/Elements/Table/Table.js +3 -3
- package/dist/Editor/Elements/Table/TableCell.js +14 -9
- 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/MiniEditor.js +4 -2
- 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 +46 -36
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectAlignment.js +3 -1
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +6 -13
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectList.js +3 -1
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +211 -91
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +11 -4
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +16 -12
- package/dist/Editor/Toolbar/PopupTool/TemplateCard.js +1 -1
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +99 -7
- package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +438 -0
- package/dist/Editor/Toolbar/PopupTool/index.js +2 -0
- 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 +1 -9
- package/dist/Editor/common/FontLoader/FontLoader.js +6 -4
- package/dist/Editor/common/Icon.js +28 -0
- package/dist/Editor/common/ImageSelector/Styles.js +3 -9
- package/dist/Editor/common/MentionsPopup/Styles.js +3 -9
- package/dist/Editor/common/MentionsPopup/index.js +0 -1
- 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/SwitchViewport/SwitchViewport.js +14 -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/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/index.js +3 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +79 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +15 -7
- package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +4 -0
- package/dist/Editor/common/Uploader.js +8 -0
- package/dist/Editor/commonStyle.js +58 -63
- package/dist/Editor/helper/ensureWrappedVariables.js +28 -0
- package/dist/Editor/helper/index.js +2 -2
- package/dist/Editor/helper/theme.js +224 -3
- package/dist/Editor/hooks/useEditorTheme.js +153 -0
- package/dist/Editor/hooks/useMouseMove.js +13 -5
- package/dist/Editor/plugins/withEmbeds.js +1 -1
- package/dist/Editor/plugins/withHTML.js +4 -2
- 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 +161 -42
- package/dist/Editor/utils/button.js +0 -14
- package/dist/Editor/utils/customHooks/useTableResize.js +2 -1
- package/dist/Editor/utils/draftToSlate.js +3 -2
- package/dist/Editor/utils/font.js +40 -37
- package/dist/Editor/utils/helper.js +88 -19
- package/dist/Editor/utils/link.js +1 -1
- package/dist/Editor/utils/pageSettings.js +14 -2
- package/dist/Editor/utils/table.js +21 -0
- package/package.json +5 -2
@@ -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 { 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
|
-
|
80
|
-
|
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) || "
|
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,31 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
485
509
|
console.log("handleCursorScroll", err);
|
486
510
|
}
|
487
511
|
};
|
488
|
-
return /*#__PURE__*/
|
512
|
+
return /*#__PURE__*/_jsxs(EditorProvider, {
|
489
513
|
theme: theme,
|
490
514
|
editor: editor,
|
491
|
-
|
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, {
|
492
531
|
classes: classes,
|
493
532
|
...props,
|
494
533
|
fullScreen: fullScreen,
|
495
534
|
footer: footer || "",
|
496
|
-
|
535
|
+
selectedTheme: selectedTheme,
|
536
|
+
children: /*#__PURE__*/_jsx(Box, {
|
497
537
|
component: "div",
|
498
538
|
className: `et-wrpr stimulate-${breakpoint} ${editorClass || ""} ${isIframe ? "iframe-editor" : ""}`,
|
499
539
|
sx: classes.root,
|
@@ -503,7 +543,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
503
543
|
"data-breakpoint": breakpoint
|
504
544
|
// onContextMenu={handleContextMenu}
|
505
545
|
,
|
506
|
-
children:
|
546
|
+
children: /*#__PURE__*/_jsxs(Slate, {
|
507
547
|
editor: editor,
|
508
548
|
initialValue: getInitialValue(debouncedValue?.current, readOnly),
|
509
549
|
onChange: handleEditorChange,
|
@@ -522,6 +562,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
522
562
|
children: /*#__PURE__*/_jsxs(Box, {
|
523
563
|
component: "div",
|
524
564
|
className: "max-content",
|
565
|
+
sx: themeProps?.sxProps || {},
|
525
566
|
"data-info": outsideEditorClickLabel,
|
526
567
|
children: [renderTopBanner(), /*#__PURE__*/_jsx("div", {
|
527
568
|
className: "scroll-area",
|
@@ -534,6 +575,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
534
575
|
padding: {
|
535
576
|
...getTRBLBreakPoints(bannerSpacing)
|
536
577
|
},
|
578
|
+
lineHeight: lineH,
|
537
579
|
width: !pageWidth || pageWidth === "fixed" ? fixedWidth : fullWidth,
|
538
580
|
height: viewport.h ? `${viewport.h}px` : `100%`,
|
539
581
|
alignSelf: "center",
|
@@ -587,6 +629,15 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
587
629
|
"data-info": outsideEditorClickLabel,
|
588
630
|
onClick: handleFooterClick,
|
589
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
|
590
641
|
})]
|
591
642
|
})
|
592
643
|
}), !readOnly ? /*#__PURE__*/_jsx(PopupTool, {
|
@@ -595,23 +646,21 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
595
646
|
setIsTextSelected: setIsTextSelected,
|
596
647
|
customProps: customProps,
|
597
648
|
editorWrapper: editorWrapper
|
598
|
-
}) : null, !readOnly
|
649
|
+
}) : null, !readOnly ? /*#__PURE__*/_jsx(SwitchViewport, {
|
599
650
|
breakpoint: breakpoint,
|
651
|
+
show: showViewport,
|
600
652
|
onChange: b => onSwitchBreakpoint(b)
|
601
653
|
}) : null]
|
602
654
|
})
|
603
655
|
}), htmlAction.showInput && /*#__PURE__*/_jsx(CodeToText, {
|
604
656
|
...htmlAction,
|
605
657
|
handleCodeToText: handleCodeToText
|
658
|
+
}), /*#__PURE__*/_jsx(FontLoader, {
|
659
|
+
...props
|
606
660
|
})]
|
607
|
-
}, id)
|
608
|
-
otherProps: {
|
609
|
-
services: otherProps?.services
|
610
|
-
},
|
611
|
-
readOnly: readOnly
|
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
@@ -995,7 +995,7 @@ blockquote {
|
|
995
995
|
|
996
996
|
.sliderInput {
|
997
997
|
width: 66px !important;
|
998
|
-
padding: 2px
|
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,22 @@ 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
|
+
}
|
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
|
+
}
|
@@ -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
|
-
|
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 || "#
|
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,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
|
277
|
-
background: bgColorHover || bgColor
|
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,
|