@flozy/editor 5.8.1 → 5.8.2
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/CommonEditor.js +6 -4
- package/dist/Editor/Editor.css +14 -15
- package/dist/Editor/Elements/AI/PopoverAIInput.js +2 -12
- package/dist/Editor/Elements/Button/EditorButton.js +2 -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/Divider/Divider.js +3 -3
- package/dist/Editor/Elements/Search/SearchList.js +8 -1
- package/dist/Editor/Elements/SimpleText/style.js +2 -2
- 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 +21 -2
- package/dist/Editor/Elements/Variables/VariableButton.js +17 -4
- package/dist/Editor/MiniEditor.js +4 -2
- package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +24 -25
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectAlignment.js +3 -1
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +1 -1
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectList.js +3 -1
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +1 -1
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +9 -3
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +5 -0
- package/dist/Editor/Toolbar/PopupTool/index.js +2 -0
- package/dist/Editor/common/FontLoader/FontList.js +3 -11
- package/dist/Editor/common/FontLoader/FontLoader.js +33 -7
- package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +1 -0
- package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +8 -2
- package/dist/Editor/common/Section/index.js +39 -29
- package/dist/Editor/common/Section/styles.js +15 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +5 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +10 -2
- package/dist/Editor/common/Uploader.js +8 -0
- package/dist/Editor/commonStyle.js +13 -12
- package/dist/Editor/helper/ensureWrappedVariables.js +28 -0
- package/dist/Editor/helper/index.js +2 -2
- package/dist/Editor/plugins/withHTML.js +8 -8
- package/dist/Editor/plugins/withLayout.js +1 -1
- package/dist/Editor/utils/SlateUtilityFunctions.js +2 -3
- package/dist/Editor/utils/button.js +4 -4
- package/dist/Editor/utils/customHooks/useTableResize.js +2 -1
- package/dist/Editor/utils/draftToSlate.js +3 -2
- package/dist/Editor/utils/helper.js +60 -19
- package/dist/Editor/utils/table.js +21 -0
- package/package.json +1 -1
@@ -4,6 +4,7 @@ import TemplateCard from "./TemplateCard";
|
|
4
4
|
import FullViewCard from "./FullViewCard";
|
5
5
|
import ButtonTemplateCard from "./ButtonTemplatesCard";
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
7
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
7
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
8
9
|
const CATEGORIES_SORT_INDEX = {
|
9
10
|
Brief: 1,
|
@@ -46,7 +47,7 @@ const ProgressBar = ({
|
|
46
47
|
alignItems: "center",
|
47
48
|
margin: 0,
|
48
49
|
padding: 0,
|
49
|
-
height: "
|
50
|
+
height: "300px",
|
50
51
|
overflow: "hidden"
|
51
52
|
},
|
52
53
|
children: /*#__PURE__*/_jsx(CircularProgress, {})
|
@@ -69,34 +70,32 @@ const AddTemplates = props => {
|
|
69
70
|
const [categories, setCategories] = useState([]);
|
70
71
|
const [category, setCategory] = useState("");
|
71
72
|
const [templates, setTemplates] = useState([]);
|
72
|
-
const [filteredTemplates, setFilteredTemplates] = useState([]);
|
73
73
|
useEffect(() => {
|
74
|
-
|
74
|
+
getCategoryList();
|
75
75
|
}, []);
|
76
|
-
const
|
77
|
-
|
76
|
+
const getCategoryList = async () => {
|
77
|
+
setLoading(true);
|
78
|
+
const categoryDB = await services("listCategory");
|
79
|
+
if (categoryDB?.data?.Template?.length > 0) {
|
80
|
+
setCategories(categoryDB.data.Template);
|
81
|
+
setCategory(categoryDB.data.Template[0]);
|
82
|
+
getTemplatesList(categoryDB.data.Template[0]);
|
83
|
+
}
|
84
|
+
setLoading(false);
|
78
85
|
};
|
79
|
-
const getTemplatesList = async
|
86
|
+
const getTemplatesList = async selectedCategory => {
|
80
87
|
setLoading(true);
|
81
|
-
const result = await services("listTemplates", {
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
a.push(b.category);
|
86
|
-
}
|
87
|
-
return a;
|
88
|
-
}, []).sort(sortCategory);
|
89
|
-
const ft = tempList?.filter(f => f.category === lic[0]);
|
90
|
-
setTemplates(tempList);
|
91
|
-
setCategories(lic);
|
92
|
-
setCategory(lic[0]);
|
93
|
-
setFilteredTemplates(ft);
|
88
|
+
const result = await services("listTemplates", {
|
89
|
+
category: selectedCategory
|
90
|
+
});
|
91
|
+
setTemplates(result?.data || []);
|
94
92
|
setLoading(false);
|
95
93
|
};
|
96
94
|
const handleChange = (event, newValue) => {
|
95
|
+
setTemplates([]);
|
97
96
|
onSearch("");
|
98
97
|
setCategory(newValue);
|
99
|
-
|
98
|
+
getTemplatesList(newValue);
|
100
99
|
};
|
101
100
|
const onSelectTemplate = card => async () => {
|
102
101
|
try {
|
@@ -183,16 +182,16 @@ const AddTemplates = props => {
|
|
183
182
|
data: categories,
|
184
183
|
handleChange: handleChange
|
185
184
|
})
|
186
|
-
}), /*#__PURE__*/
|
185
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
187
186
|
container: true,
|
188
187
|
spacing: 0,
|
189
188
|
className: `${fullScreen ? "fullscreen" : ""}`,
|
190
189
|
sx: classes.templateCardsWrpr,
|
191
|
-
children:
|
190
|
+
children: loading ? /*#__PURE__*/_jsx(ProgressBar, {
|
192
191
|
loading: loading
|
193
|
-
})
|
194
|
-
|
195
|
-
})
|
192
|
+
}) : /*#__PURE__*/_jsx(_Fragment, {
|
193
|
+
children: templates.filter(filterByTitle).map(renderTemplate)
|
194
|
+
})
|
196
195
|
})]
|
197
196
|
});
|
198
197
|
};
|
@@ -51,7 +51,8 @@ const alignmentOptions = [{
|
|
51
51
|
}];
|
52
52
|
function SelectAlignment({
|
53
53
|
editor,
|
54
|
-
classes
|
54
|
+
classes,
|
55
|
+
closeMainPopup
|
55
56
|
}) {
|
56
57
|
const selected = useMemo(() => {
|
57
58
|
return alignmentOptions.find(t => isBlockActive(editor, t.value));
|
@@ -59,6 +60,7 @@ function SelectAlignment({
|
|
59
60
|
const onChange = (format, option) => {
|
60
61
|
if (option.type === "block") {
|
61
62
|
toggleBlock(editor, format);
|
63
|
+
closeMainPopup();
|
62
64
|
}
|
63
65
|
};
|
64
66
|
return /*#__PURE__*/_jsx(CustomSelectTool, {
|
@@ -68,7 +68,8 @@ const listOptions = [{
|
|
68
68
|
}];
|
69
69
|
function SelectList({
|
70
70
|
editor,
|
71
|
-
classes
|
71
|
+
classes,
|
72
|
+
closeMainPopup
|
72
73
|
}) {
|
73
74
|
const selectedList = useMemo(() => {
|
74
75
|
return listOptions.find(t => isBlockActive(editor, t.value));
|
@@ -79,6 +80,7 @@ function SelectList({
|
|
79
80
|
} else if (option.type === "accordion") {
|
80
81
|
insertAccordion(editor);
|
81
82
|
}
|
83
|
+
closeMainPopup();
|
82
84
|
};
|
83
85
|
return /*#__PURE__*/_jsx(CustomSelectTool, {
|
84
86
|
options: listOptions,
|
@@ -125,7 +125,6 @@ function SelectTypography({
|
|
125
125
|
...upData
|
126
126
|
}
|
127
127
|
});
|
128
|
-
closeMainPopup();
|
129
128
|
};
|
130
129
|
const selectedBlock = useMemo(() => {
|
131
130
|
return typographyOptions.find(t => {
|
@@ -167,6 +166,7 @@ function SelectTypography({
|
|
167
166
|
const [sizeInNumber] = size.split("px");
|
168
167
|
updateMarkData(Number(sizeInNumber));
|
169
168
|
}
|
169
|
+
closeMainPopup();
|
170
170
|
};
|
171
171
|
return /*#__PURE__*/_jsx(CustomSelectTool, {
|
172
172
|
options: typographyOptions,
|
@@ -14,6 +14,7 @@ import MiniColorPicker from "./MiniColorPicker";
|
|
14
14
|
import SelectAlignment from "./SelectAlignment";
|
15
15
|
import SelectFontSize from "./SelectFontSize";
|
16
16
|
import InfinityAITool from "./InfinityAITool";
|
17
|
+
import { viewSlateSelection } from "../../../utils/helper";
|
17
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
18
19
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
19
20
|
const DEFAULT_COLOR = {
|
@@ -60,13 +61,15 @@ const MiniTextFormat = props => {
|
|
60
61
|
className: "verticalLine"
|
61
62
|
}), /*#__PURE__*/_jsx(SelectList, {
|
62
63
|
classes: classes,
|
63
|
-
editor: editor
|
64
|
+
editor: editor,
|
65
|
+
closeMainPopup: closeMainPopup
|
64
66
|
}), /*#__PURE__*/_jsx("div", {
|
65
67
|
className: "verticalLine mr-1"
|
66
68
|
}), /*#__PURE__*/_jsx(SelectAlignment, {
|
67
69
|
fontAlign: fontAlign,
|
68
70
|
classes: classes,
|
69
|
-
editor: editor
|
71
|
+
editor: editor,
|
72
|
+
closeMainPopup: closeMainPopup
|
70
73
|
}), /*#__PURE__*/_jsx("div", {
|
71
74
|
className: "verticalLine mr-1"
|
72
75
|
}), /*#__PURE__*/_jsx(SelectFontSize, {
|
@@ -98,7 +101,10 @@ const MiniTextFormat = props => {
|
|
98
101
|
editor: editor,
|
99
102
|
customProps: customProps
|
100
103
|
}, link.id), /*#__PURE__*/_jsx(IconButton, {
|
101
|
-
onClick: e =>
|
104
|
+
onClick: e => {
|
105
|
+
viewSlateSelection();
|
106
|
+
setAnchorEl(document.getElementById("mini-text-editor-wrapper"));
|
107
|
+
},
|
102
108
|
className: `textSettingsIcon ${open ? "btnActive" : ""}`,
|
103
109
|
children: /*#__PURE__*/_jsx(TextToolIcon, {})
|
104
110
|
}), /*#__PURE__*/_jsx(Popper, {
|
@@ -416,6 +416,11 @@ const usePopupStyle = theme => ({
|
|
416
416
|
"& .MuiOutlinedInput-notchedOutline": {
|
417
417
|
border: `1px solid ${theme?.palette?.editor?.inputFieldBorder} !important`
|
418
418
|
},
|
419
|
+
'& .MuiInputBase-root': {
|
420
|
+
'& input': {
|
421
|
+
border: "none !important"
|
422
|
+
}
|
423
|
+
},
|
419
424
|
"& svg": {
|
420
425
|
width: "20px",
|
421
426
|
height: "24px"
|
@@ -9,6 +9,7 @@ import { useEditorContext } from "../../hooks/useMouseMove";
|
|
9
9
|
import usePopupStyles from "../PopupTool/PopupToolStyle";
|
10
10
|
import useEditorScroll from "../../hooks/useEditorScroll";
|
11
11
|
import { isCarouselSelected } from "../../helper";
|
12
|
+
import { hideSlateSelection } from "../../utils/helper";
|
12
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
13
14
|
const PopupTool = props => {
|
14
15
|
const {
|
@@ -83,6 +84,7 @@ const PopupTool = props => {
|
|
83
84
|
setAnchorEl(null);
|
84
85
|
} else {
|
85
86
|
updateAnchorEl();
|
87
|
+
hideSlateSelection(); // removes slate selection background, when there is no selection
|
86
88
|
}
|
87
89
|
}, [selection]);
|
88
90
|
useEffect(() => {
|
@@ -1,11 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
export const otherFonts = ["PoppinsRegular", "PoppinsBold", "Monaco", "Qwitcher Grypen", "Bulgarian Garamond", "Redacted Script", "Herr Von Muellerhoff", "Dawning of a New Day", "Coming Soon", "Engagement", "Ingrid Darling", "La Belle Aurore", "Mea Culpa", "The Girl Next Door", "Helvetica", "Georgia", "Times New Roman", "Courier New", "Impact"];
|
5
|
-
export const googleFontList = ["Roboto", "Noto Sans JP", "Poppins", "Lato", "Inter", "Roboto Condensed", "Roboto Mono", "Oswald", "Noto Sans", "Nunito", "Nunito Sans", "Ubuntu", "Rubik", "Playfair Display", "Noto Sans KR", "Roboto Slab", "PT Sans", "Kanit", "Work Sans", "Lora", "DM Sans", "Mulish", "Quicksand", "Fira Sans", "Noto Sans TC", "Inconsolata", "Barlow", "Manrope", "IBM Plex Sans", "PT Serif", "Karla", "Titillium Web", "Heebo", "Noto Serif", "Nanum Gothic", "Noto Color Emoji", "Agdasima", "Bebas Neue", "Libre Franklin", "Mukta", "Outfit", "Josefin Sans", "Source Code Pro", "Jost", "Space Grotesk", "Hind Siliguri", "Arimo", "Cabin", "Barlow Condensed", "Dosis", "Fira Sans Condensed", "Bitter", "Archivo", "Figtree", "Noto Serif JP", "PT Sans Narrow", "Abel", "Noto Sans SC",
|
6
|
-
// "Source Sans 3",
|
7
|
-
"Hind",
|
8
|
-
// "Exo 2",
|
9
|
-
"Teko", "Oxygen", "Cairo", "Crimson Text", "Plus Jakarta Sans", "Overpass", "Pacifico", "Prompt", "Red Hat Display", "Varela Round", "Cormorant Garamond", "Assistant", "Comfortaa", "Lexend", "Signika Negative",
|
10
|
-
// "M PLUS Rounded 1c",
|
11
|
-
"Fjalla One", "Caveat", "IBM Plex Mono", "Arvo", "Lobster", "Schibsted Grotesk", "Chakra Petch", "Maven Pro", "Sora", "Kalam", "Onest", "Space Grotesk", "Outfit", 'Titillium Web', ...defaultFonts];
|
1
|
+
const otherFonts = ["PoppinsRegular", "PoppinsBold", "Qwitcher Grypen", "Bulgarian Garamond", "Redacted Script", "Herr Von Muellerhoff", "Dawning of a New Day", "Coming Soon", "Engagement", "Ingrid Darling", "La Belle Aurore", "Mea Culpa", "The Girl Next Door"];
|
2
|
+
const mostUsedGoogleFonts = ["Roboto", "Poppins", "Lato", "Inter", "Nunito", "Ubuntu", "Oswald", "Rubik", "Roboto Slab", "PT Sans", "Work Sans", "Lora", "Mulish", "DM Sans", "Fira Sans", "Quicksand", "Barlow", "Manrope", "IBM Plex Sans", "PT Serif", "Libre Franklin", "Bebas Neue", "Cabin", "Titillium Web", "Heebo", "Noto Serif", "Jost", "Source Code Pro", "Josefin Sans", "Dosis", "Fira Sans Condensed", "Archivo", "Noto Serif JP", "Crimson Text", "Cairo", "Pacifico", "Red Hat Display", "Assistant", "Comfortaa", "Lexend", "Fjalla One", "Caveat", "Arvo", "Lobster", "Schibsted Grotesk", "EB Garamond", "Sora", "Kalam", "Onest", "Space Grotesk", "Outfit", "Plus Jakarta Sans"];
|
3
|
+
export const googleFontList = [...mostUsedGoogleFonts, ...otherFonts];
|
@@ -1,7 +1,11 @@
|
|
1
|
-
import { useEffect } from "react";
|
1
|
+
import { useEffect, useState } from "react";
|
2
2
|
import WebFont from "webfontloader";
|
3
3
|
import { useEditorContext } from "../../hooks/useMouseMove";
|
4
|
-
import {
|
4
|
+
import { googleFontList } from "./FontList";
|
5
|
+
import CircularProgress from '@mui/material/CircularProgress';
|
6
|
+
import Box from "@mui/material/Box";
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
8
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
5
9
|
const FontLoader = props => {
|
6
10
|
const {
|
7
11
|
otherProps,
|
@@ -10,14 +14,20 @@ const FontLoader = props => {
|
|
10
14
|
const {
|
11
15
|
setFontFamilies
|
12
16
|
} = useEditorContext();
|
17
|
+
const [loading, setLoading] = useState(false);
|
13
18
|
const loadFontsInBatches = (families, batchSize = 5, maxRetries = 3) => {
|
14
19
|
let currentIndex = 0;
|
15
20
|
let retryCount = 0;
|
21
|
+
let hideLoaderOn = 30;
|
16
22
|
function loadNextBatch() {
|
17
23
|
if (currentIndex >= families?.length) {
|
18
24
|
// console.log("All fonts have been loaded");
|
25
|
+
setLoading(false);
|
19
26
|
return;
|
20
27
|
}
|
28
|
+
if (currentIndex >= hideLoaderOn) {
|
29
|
+
setLoading(false);
|
30
|
+
}
|
21
31
|
const batch = families?.slice(currentIndex, currentIndex + batchSize);
|
22
32
|
const batchWithWeights = batch.map(font => `${font}:300,400,600,700`);
|
23
33
|
WebFont.load({
|
@@ -54,21 +64,21 @@ const FontLoader = props => {
|
|
54
64
|
loadNextBatch();
|
55
65
|
};
|
56
66
|
useEffect(() => {
|
57
|
-
let families = [...
|
67
|
+
let families = [...googleFontList];
|
58
68
|
if (!readOnly) {
|
59
69
|
otherProps?.services("listGoogleFont", []).then(data => {
|
60
|
-
families = [...
|
61
|
-
const filteredfamilies = families?.filter(font => !font?.includes("Material"));
|
70
|
+
families = [...(data?.data || [])];
|
62
71
|
setFontFamilies({
|
63
72
|
id: 1,
|
64
73
|
format: "fontFamily",
|
65
74
|
type: "fontfamilydropdown",
|
66
|
-
options:
|
75
|
+
options: families || []
|
67
76
|
});
|
68
77
|
loadFontsInBatches(families);
|
69
78
|
}).catch(err => {
|
70
79
|
// console.log(err);
|
71
80
|
});
|
81
|
+
// setLoading(true);
|
72
82
|
} else {
|
73
83
|
function correctFontArray(fontString) {
|
74
84
|
let fontsArray = fontString.split(",");
|
@@ -90,9 +100,25 @@ const FontLoader = props => {
|
|
90
100
|
families = families?.map(font => font?.replace(/\"/g, ""));
|
91
101
|
families = families?.map(font => font?.replace(", sans-serif", "")); //This is temporary fix for patch
|
92
102
|
families = families.filter(font => googleFontList.includes(font));
|
103
|
+
// setLoading(true);
|
93
104
|
loadFontsInBatches(families);
|
94
105
|
}
|
95
106
|
}, []);
|
96
|
-
return
|
107
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
108
|
+
children: loading ? /*#__PURE__*/_jsx(Box, {
|
109
|
+
sx: {
|
110
|
+
position: 'absolute',
|
111
|
+
top: 0,
|
112
|
+
left: 0,
|
113
|
+
right: 0,
|
114
|
+
bottom: 0,
|
115
|
+
zIndex: 99999,
|
116
|
+
display: 'flex',
|
117
|
+
justifyContent: 'center',
|
118
|
+
alignItems: 'center'
|
119
|
+
},
|
120
|
+
children: /*#__PURE__*/_jsx(CircularProgress, {})
|
121
|
+
}) : null
|
122
|
+
});
|
97
123
|
};
|
98
124
|
export default FontLoader;
|
@@ -9,17 +9,23 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
9
|
const SwitchViewport = props => {
|
10
10
|
const {
|
11
11
|
breakpoint,
|
12
|
-
onChange
|
12
|
+
onChange,
|
13
|
+
show
|
13
14
|
} = props;
|
14
15
|
const classes = useSwitchViewport();
|
15
16
|
const {
|
17
|
+
setSelectedElement,
|
16
18
|
setActiveBreakPoint
|
17
19
|
} = useEditorContext();
|
18
20
|
useEffect(() => {
|
19
|
-
|
21
|
+
// to reset selection on viewport changes - FS-6589
|
22
|
+
setSelectedElement({});
|
20
23
|
}, [breakpoint]);
|
21
24
|
return /*#__PURE__*/_jsxs(Box, {
|
22
25
|
sx: classes.root,
|
26
|
+
style: {
|
27
|
+
display: show ? "block" : "none"
|
28
|
+
},
|
23
29
|
children: [/*#__PURE__*/_jsx(Tooltip, {
|
24
30
|
title: "Desktop View",
|
25
31
|
children: /*#__PURE__*/_jsx(IconButton, {
|
@@ -13,6 +13,35 @@ import { SectionSettingIcon } from "../iconListV2";
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
14
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
15
15
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
16
|
+
const Toolbar = ({
|
17
|
+
fromPopper,
|
18
|
+
readOnly,
|
19
|
+
showTool,
|
20
|
+
onSettings
|
21
|
+
}) => {
|
22
|
+
return !readOnly && !showTool ? /*#__PURE__*/_jsx(Box, {
|
23
|
+
component: "div",
|
24
|
+
className: `element-toolbar no-border-button hr section-tw sectionIcon`,
|
25
|
+
contentEditable: false,
|
26
|
+
style: fromPopper ? {
|
27
|
+
position: "unset",
|
28
|
+
marginLeft: "28px",
|
29
|
+
paddingTop: "4px",
|
30
|
+
marginRight: "10px",
|
31
|
+
height: "100%"
|
32
|
+
} : {
|
33
|
+
left: "-28px",
|
34
|
+
top: "1px"
|
35
|
+
},
|
36
|
+
children: /*#__PURE__*/_jsx(Tooltip, {
|
37
|
+
title: "Section Settings",
|
38
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
39
|
+
onClick: onSettings,
|
40
|
+
children: /*#__PURE__*/_jsx(SectionSettingIcon, {})
|
41
|
+
})
|
42
|
+
})
|
43
|
+
}) : null;
|
44
|
+
};
|
16
45
|
const list_types = ["orderedList", "unorderedList"];
|
17
46
|
const Section = props => {
|
18
47
|
const themeReact = useTheme();
|
@@ -57,32 +86,6 @@ const Section = props => {
|
|
57
86
|
const onSettings = () => {
|
58
87
|
setOpenSettings(true);
|
59
88
|
};
|
60
|
-
const Toolbar = ({
|
61
|
-
fromPopper
|
62
|
-
}) => {
|
63
|
-
return !readOnly && !showTool ? /*#__PURE__*/_jsx(Box, {
|
64
|
-
component: "div",
|
65
|
-
className: `element-toolbar no-border-button hr section-tw sectionIcon`,
|
66
|
-
contentEditable: false,
|
67
|
-
style: fromPopper ? {
|
68
|
-
position: "unset",
|
69
|
-
marginLeft: "28px",
|
70
|
-
paddingTop: "4px",
|
71
|
-
marginRight: "10px",
|
72
|
-
height: "100%"
|
73
|
-
} : {
|
74
|
-
left: "-28px",
|
75
|
-
top: "1px"
|
76
|
-
},
|
77
|
-
children: /*#__PURE__*/_jsx(Tooltip, {
|
78
|
-
title: "Section Settings",
|
79
|
-
children: /*#__PURE__*/_jsx(IconButton, {
|
80
|
-
onClick: onSettings,
|
81
|
-
children: /*#__PURE__*/_jsx(SectionSettingIcon, {})
|
82
|
-
})
|
83
|
-
})
|
84
|
-
}) : null;
|
85
|
-
};
|
86
89
|
const onSave = data => {
|
87
90
|
const updateData = {
|
88
91
|
...data
|
@@ -167,19 +170,26 @@ const Section = props => {
|
|
167
170
|
bgcolor: "background.paper",
|
168
171
|
height: "30px",
|
169
172
|
position: "relative",
|
170
|
-
background: theme?.palette?.type ===
|
173
|
+
background: theme?.palette?.type === "dark" ? theme?.palette?.editor?.miniToolBarBackground : "#F6F6F6"
|
171
174
|
},
|
172
175
|
children: [!readOnly && !showTool ? /*#__PURE__*/_jsx(DragHandle, {
|
173
176
|
...props,
|
174
177
|
fromPopper: true
|
175
178
|
}) : null, /*#__PURE__*/_jsx(Toolbar, {
|
176
|
-
fromPopper: true
|
179
|
+
fromPopper: true,
|
180
|
+
readOnly: readOnly,
|
181
|
+
showTool: showTool,
|
182
|
+
onSettings: onSettings
|
177
183
|
})]
|
178
184
|
})
|
179
185
|
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
180
186
|
children: [!readOnly && !showTool ? /*#__PURE__*/_jsx(DragHandle, {
|
181
187
|
...props
|
182
|
-
}) : null, /*#__PURE__*/_jsx(Toolbar, {
|
188
|
+
}) : null, /*#__PURE__*/_jsx(Toolbar, {
|
189
|
+
readOnly: readOnly,
|
190
|
+
showTool: showTool,
|
191
|
+
onSettings: onSettings
|
192
|
+
})]
|
183
193
|
}), children]
|
184
194
|
}), openSetttings ? /*#__PURE__*/_jsx(SectionPopup, {
|
185
195
|
element: {
|
@@ -11,6 +11,9 @@ const SectionStyle = (themeReact, theme) => ({
|
|
11
11
|
"& .sectionIcon": {
|
12
12
|
opacity: 1
|
13
13
|
},
|
14
|
+
'& .dividerIcon': {
|
15
|
+
opacity: 1
|
16
|
+
},
|
14
17
|
"& .sectionPopper": {
|
15
18
|
opacity: 1
|
16
19
|
}
|
@@ -52,6 +55,18 @@ const SectionStyle = (themeReact, theme) => ({
|
|
52
55
|
opacity: 1
|
53
56
|
}
|
54
57
|
},
|
58
|
+
"& .dividerIcon": {
|
59
|
+
opacity: 0,
|
60
|
+
padding: "0px",
|
61
|
+
background: "transparent",
|
62
|
+
border: "none",
|
63
|
+
width: "20px",
|
64
|
+
height: "20px",
|
65
|
+
"& button": {
|
66
|
+
boxShadow: "none",
|
67
|
+
background: "transparent"
|
68
|
+
}
|
69
|
+
},
|
55
70
|
"& .ed-section-inner": {
|
56
71
|
[themeReact.breakpoints.between("xs", "md")]: {
|
57
72
|
maxWidth: `320px !important`,
|
@@ -73,6 +73,11 @@ const BackgroundImage = props => {
|
|
73
73
|
children: "REMOVE"
|
74
74
|
}) : /*#__PURE__*/_jsx(Grid, {
|
75
75
|
className: "uploadImageText",
|
76
|
+
sx: {
|
77
|
+
padding: 0,
|
78
|
+
background: `${theme?.palette?.editor?.inputFieldBgColor}`,
|
79
|
+
border: `1px solid ${theme?.palette?.editor?.inputFieldBorder}`
|
80
|
+
},
|
76
81
|
children: /*#__PURE__*/_jsxs(Button, {
|
77
82
|
component: "label",
|
78
83
|
variant: "text",
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { Box, Card, Checkbox, FormControlLabel, Grid, Tooltip, Typography } from "@mui/material";
|
2
2
|
import React from "react";
|
3
3
|
import Icon from "../../Icon";
|
4
|
+
import { useEditorContext } from "../../../hooks/useMouseMove";
|
4
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
5
6
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
6
7
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
@@ -15,7 +16,10 @@ const RenderCard = ({
|
|
15
16
|
return /*#__PURE__*/_jsx(Card, {
|
16
17
|
sx: {
|
17
18
|
position: 'relative',
|
18
|
-
padding: "10px"
|
19
|
+
padding: "10px",
|
20
|
+
'& .MuiCheckbox-root svg': {
|
21
|
+
fill: 'unset !important'
|
22
|
+
}
|
19
23
|
},
|
20
24
|
children: /*#__PURE__*/_jsx(FormControlLabel, {
|
21
25
|
control: /*#__PURE__*/_jsx(Checkbox, {
|
@@ -81,6 +85,9 @@ const CardsMapping = props => {
|
|
81
85
|
selectedCard,
|
82
86
|
infoIcon
|
83
87
|
} = data;
|
88
|
+
const {
|
89
|
+
theme
|
90
|
+
} = useEditorContext();
|
84
91
|
const activeCard = value === selectedCard;
|
85
92
|
const handleChange = e => {
|
86
93
|
if (selectedCard === data?.value) {
|
@@ -99,7 +106,8 @@ const CardsMapping = props => {
|
|
99
106
|
sx: {
|
100
107
|
marginBottom: "12px",
|
101
108
|
"& .MuiPaper-root": {
|
102
|
-
|
109
|
+
background: theme?.palette?.editor?.miniToolBarBackground,
|
110
|
+
border: activeCard ? "1px solid #2563EB" : `1px solid ${theme?.palette?.editor?.inputFieldBorder}`,
|
103
111
|
borderRadius: "8px",
|
104
112
|
boxShadow: activeCard ? "0px 4px 16px 0px #2563EB40" : "unset"
|
105
113
|
}
|
@@ -4,6 +4,7 @@ import { convertBase64 } from "../utils/helper";
|
|
4
4
|
import { uploadFile } from "../service/fileupload";
|
5
5
|
import Icon from "./Icon";
|
6
6
|
import UploadStyles from "../common/ImageSelector/UploadStyles";
|
7
|
+
import { useEditorContext } from "../hooks/useMouseMove";
|
7
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
8
9
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
9
10
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
@@ -18,6 +19,9 @@ const Uploader = props => {
|
|
18
19
|
const [base64, setBase64] = useState(value?.url);
|
19
20
|
const [fileName, setFileName] = useState("");
|
20
21
|
const [uploading, setUploading] = useState(false);
|
22
|
+
const {
|
23
|
+
theme
|
24
|
+
} = useEditorContext();
|
21
25
|
const handleChange = async e => {
|
22
26
|
const uFile = e.target.files[0];
|
23
27
|
const strImage = await convertBase64(uFile);
|
@@ -99,6 +103,10 @@ const Uploader = props => {
|
|
99
103
|
className: "uploadImageSection",
|
100
104
|
children: base64 ? renderThumb() : /*#__PURE__*/_jsx(Grid, {
|
101
105
|
className: "uploadImageText",
|
106
|
+
sx: {
|
107
|
+
background: `${theme?.palette?.editor?.inputFieldBgColor}`,
|
108
|
+
border: `1px solid ${theme?.palette?.editor?.inputFieldBorder}`
|
109
|
+
},
|
102
110
|
children: /*#__PURE__*/_jsxs(Button, {
|
103
111
|
component: "label",
|
104
112
|
variant: "text",
|
@@ -49,16 +49,20 @@ const useCommonStyle = theme => ({
|
|
49
49
|
fontWeight: "500",
|
50
50
|
fontFamily: "Inter, sans-serif"
|
51
51
|
},
|
52
|
-
"& p": {
|
53
|
-
marginBottom: "7px",
|
54
|
-
marginTop: "4px"
|
55
|
-
},
|
56
52
|
"& .MuiPaper-root": {
|
57
|
-
border:
|
53
|
+
border: `unset !important`,
|
58
54
|
borderRadius: '0px',
|
59
55
|
height: 'fit-content',
|
60
56
|
padding: '2px'
|
61
57
|
},
|
58
|
+
"& p": {
|
59
|
+
marginBottom: "7px",
|
60
|
+
marginTop: "4px"
|
61
|
+
},
|
62
|
+
"& p": {
|
63
|
+
marginBottom: "7px",
|
64
|
+
marginTop: "4px"
|
65
|
+
},
|
62
66
|
"& .muiIconsListParent": {
|
63
67
|
"& svg": {
|
64
68
|
color: `${theme?.palette?.editor?.svgTextAlignStrokeColor} !important`
|
@@ -71,9 +75,6 @@ const useCommonStyle = theme => ({
|
|
71
75
|
},
|
72
76
|
"&::-webkit-scrollbar-thumb": {
|
73
77
|
background: `${theme?.palette?.editor?.brainPopupScroll} !important`
|
74
|
-
},
|
75
|
-
"&::-webkit-scrollbar-track": {
|
76
|
-
visibility: "hidden"
|
77
78
|
}
|
78
79
|
},
|
79
80
|
"& .MuiGrid-root>.MuiGrid-item": {
|
@@ -470,10 +471,6 @@ const useCommonStyle = theme => ({
|
|
470
471
|
}
|
471
472
|
}
|
472
473
|
},
|
473
|
-
pageSettingPopUpRoot: {
|
474
|
-
padding: "16px 8px 16px 10px!important",
|
475
|
-
height: "100%"
|
476
|
-
},
|
477
474
|
buttonMoreOption: {
|
478
475
|
background: `${theme?.palette?.editor?.aiInputBackground} !important`,
|
479
476
|
border: `1px solid ${theme?.palette?.editor?.buttonBorder1} !important`,
|
@@ -486,6 +483,10 @@ const useCommonStyle = theme => ({
|
|
486
483
|
}
|
487
484
|
}
|
488
485
|
},
|
486
|
+
pageSettingPopUpRoot: {
|
487
|
+
padding: "16px 8px 16px 10px!important",
|
488
|
+
height: "100%"
|
489
|
+
},
|
489
490
|
buttonMoreOption2: {
|
490
491
|
background: `${theme?.palette?.editor?.aiInputBackground} !important`,
|
491
492
|
border: `1px solid ${theme?.palette?.editor?.buttonBorder1} !important`,
|
@@ -0,0 +1,28 @@
|
|
1
|
+
export const ensureWrappedVariables = content => {
|
2
|
+
return content.map(node => {
|
3
|
+
if (node.children) {
|
4
|
+
return {
|
5
|
+
...node,
|
6
|
+
children: node.children.reduce((result, child, index, arr) => {
|
7
|
+
if (child.type === "variables") {
|
8
|
+
if (index === 0 || !arr[index - 1].text || arr[index - 1].text.trim() === "") {
|
9
|
+
result.push({
|
10
|
+
text: ""
|
11
|
+
});
|
12
|
+
}
|
13
|
+
result.push(child);
|
14
|
+
if (index === arr.length - 1 || !arr[index + 1]?.text || arr[index + 1]?.text.trim() === "") {
|
15
|
+
result.push({
|
16
|
+
text: ""
|
17
|
+
});
|
18
|
+
}
|
19
|
+
} else {
|
20
|
+
result.push(child);
|
21
|
+
}
|
22
|
+
return result;
|
23
|
+
}, [])
|
24
|
+
};
|
25
|
+
}
|
26
|
+
return node;
|
27
|
+
});
|
28
|
+
};
|