@flozy/editor 5.8.4 → 5.8.6
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 +3 -6
- package/dist/Editor/CommonEditor.js +5 -2
- package/dist/Editor/Editor.css +2 -2
- package/dist/Editor/Elements/AI/PopoverAIInput.js +2 -12
- package/dist/Editor/Elements/Button/EditorButton.js +1 -0
- 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/Form/Form.js +1 -0
- package/dist/Editor/Elements/FreeGrid/styles.js +1 -0
- 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/MiniEditor.js +4 -2
- package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +37 -28
- 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/TemplateCard.js +1 -1
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +45 -0
- package/dist/Editor/Toolbar/PopupTool/index.js +2 -0
- package/dist/Editor/common/FontLoader/FontLoader.js +4 -4
- package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +6 -0
- package/dist/Editor/common/Section/index.js +39 -29
- package/dist/Editor/common/Section/styles.js +0 -15
- 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/pageSettingsStyle.js +4 -0
- package/dist/Editor/commonStyle.js +5 -0
- package/dist/Editor/helper/ensureWrappedVariables.js +28 -0
- package/dist/Editor/helper/theme.js +24 -1
- package/dist/Editor/hooks/useMouseMove.js +5 -2
- package/dist/Editor/utils/SlateUtilityFunctions.js +10 -4
- package/dist/Editor/utils/customHooks/useTableResize.js +2 -1
- package/dist/Editor/utils/helper.js +41 -0
- package/dist/Editor/utils/pageSettings.js +14 -2
- 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,41 +70,49 @@ 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
|
-
const onSelectTemplate = card => () => {
|
100
|
+
const onSelectTemplate = card => async () => {
|
102
101
|
try {
|
103
|
-
|
102
|
+
const {
|
103
|
+
data
|
104
|
+
} = await services("templateContent", {
|
105
|
+
id: card?.id
|
106
|
+
});
|
107
|
+
const content = data?.content;
|
108
|
+
if (content) {
|
109
|
+
editor.insertNode(JSON.parse(content));
|
110
|
+
} else {
|
111
|
+
console.log("No data found");
|
112
|
+
}
|
104
113
|
onClose();
|
105
114
|
} catch (err) {
|
106
|
-
console.log(err);
|
115
|
+
console.log("Error inserting template content into editor:", err);
|
107
116
|
}
|
108
117
|
};
|
109
118
|
const filterByTitle = f => {
|
@@ -173,16 +182,16 @@ const AddTemplates = props => {
|
|
173
182
|
data: categories,
|
174
183
|
handleChange: handleChange
|
175
184
|
})
|
176
|
-
}), /*#__PURE__*/
|
185
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
177
186
|
container: true,
|
178
187
|
spacing: 0,
|
179
188
|
className: `${fullScreen ? "fullscreen" : ""}`,
|
180
189
|
sx: classes.templateCardsWrpr,
|
181
|
-
children:
|
190
|
+
children: loading ? /*#__PURE__*/_jsx(ProgressBar, {
|
182
191
|
loading: loading
|
183
|
-
})
|
184
|
-
|
185
|
-
})
|
192
|
+
}) : /*#__PURE__*/_jsx(_Fragment, {
|
193
|
+
children: templates.filter(filterByTitle).map(renderTemplate)
|
194
|
+
})
|
186
195
|
})]
|
187
196
|
});
|
188
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, {
|
@@ -47,7 +47,7 @@ const TemplateCard = props => {
|
|
47
47
|
}), /*#__PURE__*/_jsx(CardMedia, {
|
48
48
|
className: `template-card-media ${fullScreen ? "fullscreen" : ""}`,
|
49
49
|
component: "div",
|
50
|
-
image: m?.thumbnail,
|
50
|
+
image: m?.compressedThum || m?.thumbnail,
|
51
51
|
alt: m?.title,
|
52
52
|
sx: classes.templateCardMedia
|
53
53
|
}), /*#__PURE__*/_jsx(PreviewAndSelect, {
|
@@ -14,6 +14,8 @@ import SelectSuperSubscript from "./MiniTextFormat/SelectSuperSubscript";
|
|
14
14
|
import { ColorResetIcon, TextDefaultStyleIcon } from "../../common/iconListV2";
|
15
15
|
import FontFamilyAutocomplete from "../FormatTools/FontFamilyAutocomplete";
|
16
16
|
import { useEditorContext } from "../../hooks/useMouseMove";
|
17
|
+
import LineSpacing from "../../common/StyleBuilder/fieldTypes/lineSpacing";
|
18
|
+
import { getPageSettings } from "../../utils/pageSettings";
|
17
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
18
20
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
19
21
|
const allTools = toolbarGroups.flat();
|
@@ -31,10 +33,18 @@ const TextFormat = props => {
|
|
31
33
|
const [anchorEl, setAnchorEl] = useState(null);
|
32
34
|
const [type, setType] = useState(null);
|
33
35
|
const open = Boolean(anchorEl);
|
36
|
+
const {
|
37
|
+
element: pageSt
|
38
|
+
} = getPageSettings(editor) || {};
|
39
|
+
const pageSettingLine = pageSt?.pageProps?.lineHeight;
|
34
40
|
const {
|
35
41
|
fontFamilies,
|
36
42
|
theme
|
37
43
|
} = useEditorContext();
|
44
|
+
const {
|
45
|
+
activeBreakPoint
|
46
|
+
} = useEditorContext();
|
47
|
+
const breakpoint = activeBreakPoint === "" ? "lg" : activeBreakPoint;
|
38
48
|
const fontWeight = allTools.find(f => f.format === "fontWeight");
|
39
49
|
const fontStyle = allTools.filter(f => f.type === "mark" && f.format !== "strikethrough" && f.format !== "superscript" && f.format !== "subscript");
|
40
50
|
const fontAlign = allTools.filter(f => f.format?.indexOf("align") >= 0);
|
@@ -51,6 +61,8 @@ const TextFormat = props => {
|
|
51
61
|
color: "",
|
52
62
|
bgColor: ""
|
53
63
|
};
|
64
|
+
let lineSpacingValue = activeMark(editor, 'lineHeight');
|
65
|
+
lineSpacingValue = lineSpacingValue?.[breakpoint] !== undefined ? lineSpacingValue : pageSettingLine;
|
54
66
|
const handleColorPicker = type => e => {
|
55
67
|
setType(type);
|
56
68
|
setAnchorEl(e.currentTarget);
|
@@ -91,6 +103,13 @@ const TextFormat = props => {
|
|
91
103
|
value
|
92
104
|
});
|
93
105
|
};
|
106
|
+
const handleLineSpacing = data => {
|
107
|
+
const [[format, value]] = Object.entries(data);
|
108
|
+
addMarkData(editor, {
|
109
|
+
format,
|
110
|
+
value
|
111
|
+
});
|
112
|
+
};
|
94
113
|
return /*#__PURE__*/_jsxs(Grid, {
|
95
114
|
container: true,
|
96
115
|
sx: classes.textFormatWrapper,
|
@@ -360,6 +379,32 @@ const TextFormat = props => {
|
|
360
379
|
xs: 12,
|
361
380
|
sx: classes.dividerGrid,
|
362
381
|
children: /*#__PURE__*/_jsx(Divider, {})
|
382
|
+
}), /*#__PURE__*/_jsxs(Grid, {
|
383
|
+
item: true,
|
384
|
+
xs: 12,
|
385
|
+
children: [/*#__PURE__*/_jsx(Typography, {
|
386
|
+
variant: "body1",
|
387
|
+
color: "primary",
|
388
|
+
sx: classes.typoLabel,
|
389
|
+
children: "Line Spacing"
|
390
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
391
|
+
item: true,
|
392
|
+
xs: 12,
|
393
|
+
className: "typo-icons",
|
394
|
+
sx: classes.evenSpace,
|
395
|
+
children: /*#__PURE__*/_jsx(LineSpacing, {
|
396
|
+
value: lineSpacingValue,
|
397
|
+
onChange: handleLineSpacing,
|
398
|
+
data: {
|
399
|
+
key: 'lineHeight'
|
400
|
+
}
|
401
|
+
})
|
402
|
+
})]
|
403
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
404
|
+
item: true,
|
405
|
+
xs: 12,
|
406
|
+
sx: classes.dividerGrid,
|
407
|
+
children: /*#__PURE__*/_jsx(Divider, {})
|
363
408
|
}), /*#__PURE__*/_jsx(Grid, {
|
364
409
|
item: true,
|
365
410
|
xs: 12,
|
@@ -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(() => {
|
@@ -41,9 +41,9 @@ const FontLoader = props => {
|
|
41
41
|
// Retry loading the same batch
|
42
42
|
loadNextBatch();
|
43
43
|
} else {
|
44
|
-
console.log(
|
45
|
-
|
46
|
-
);
|
44
|
+
// console.log(
|
45
|
+
// `Max retries reached for batch: ${batch}. Moving to the next batch.`
|
46
|
+
// );
|
47
47
|
currentIndex += batchSize;
|
48
48
|
retryCount = 0; // Reset retry count for the next batch
|
49
49
|
loadNextBatch();
|
@@ -67,7 +67,7 @@ const FontLoader = props => {
|
|
67
67
|
});
|
68
68
|
loadFontsInBatches(families);
|
69
69
|
}).catch(err => {
|
70
|
-
console.log(err);
|
70
|
+
// console.log(err);
|
71
71
|
});
|
72
72
|
} else {
|
73
73
|
function correctFontArray(fontString) {
|
@@ -3,6 +3,7 @@ import PersonalVideoIcon from "@mui/icons-material/PersonalVideo";
|
|
3
3
|
import PhoneIphoneIcon from "@mui/icons-material/PhoneIphone";
|
4
4
|
import useSwitchViewport from "./styles";
|
5
5
|
import { useEffect } from "react";
|
6
|
+
import { useEditorContext } from "../../../hooks/useMouseMove";
|
6
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
7
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
8
9
|
const SwitchViewport = props => {
|
@@ -11,6 +12,9 @@ const SwitchViewport = props => {
|
|
11
12
|
onChange
|
12
13
|
} = props;
|
13
14
|
const classes = useSwitchViewport();
|
15
|
+
const {
|
16
|
+
setActiveBreakPoint
|
17
|
+
} = useEditorContext();
|
14
18
|
useEffect(() => {
|
15
19
|
console.log(breakpoint);
|
16
20
|
}, [breakpoint]);
|
@@ -21,6 +25,7 @@ const SwitchViewport = props => {
|
|
21
25
|
children: /*#__PURE__*/_jsx(IconButton, {
|
22
26
|
className: `${!breakpoint || breakpoint === "lg" ? "active" : ""}`,
|
23
27
|
onClick: () => {
|
28
|
+
setActiveBreakPoint("");
|
24
29
|
onChange("");
|
25
30
|
},
|
26
31
|
children: /*#__PURE__*/_jsx(PersonalVideoIcon, {})
|
@@ -30,6 +35,7 @@ const SwitchViewport = props => {
|
|
30
35
|
children: /*#__PURE__*/_jsx(IconButton, {
|
31
36
|
className: `${breakpoint === "xs" ? "active" : ""}`,
|
32
37
|
onClick: () => {
|
38
|
+
setActiveBreakPoint("xs");
|
33
39
|
onChange("xs");
|
34
40
|
},
|
35
41
|
children: /*#__PURE__*/_jsx(PhoneIphoneIcon, {})
|
@@ -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,9 +11,6 @@ const SectionStyle = (themeReact, theme) => ({
|
|
11
11
|
"& .sectionIcon": {
|
12
12
|
opacity: 1
|
13
13
|
},
|
14
|
-
'& .dividerIcon': {
|
15
|
-
opacity: 1
|
16
|
-
},
|
17
14
|
"& .sectionPopper": {
|
18
15
|
opacity: 1
|
19
16
|
}
|
@@ -55,18 +52,6 @@ const SectionStyle = (themeReact, theme) => ({
|
|
55
52
|
opacity: 1
|
56
53
|
}
|
57
54
|
},
|
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
|
-
},
|
70
55
|
"& .ed-section-inner": {
|
71
56
|
[themeReact.breakpoints.between("xs", "md")]: {
|
72
57
|
maxWidth: `320px !important`,
|
@@ -18,6 +18,7 @@ import FontSize from "./fontSize";
|
|
18
18
|
import SelectSwitch from "./selectSwitch";
|
19
19
|
import CardsMapping from "./card";
|
20
20
|
import MetaDataMapping from "./metaDataMapping";
|
21
|
+
import LineSpacing from "./lineSpacing";
|
21
22
|
const FieldMap = {
|
22
23
|
text: Text,
|
23
24
|
bannerSpacing: BannerSpacing,
|
@@ -38,6 +39,7 @@ const FieldMap = {
|
|
38
39
|
fontSize: FontSize,
|
39
40
|
selectSwitch: SelectSwitch,
|
40
41
|
card: CardsMapping,
|
41
|
-
metadatamapping: MetaDataMapping
|
42
|
+
metadatamapping: MetaDataMapping,
|
43
|
+
lineSpacing: LineSpacing
|
42
44
|
};
|
43
45
|
export default FieldMap;
|
@@ -0,0 +1,79 @@
|
|
1
|
+
import React, { useState } from "react";
|
2
|
+
import { Grid, Slider, Typography, Box } from "@mui/material";
|
3
|
+
import { getBreakPointsValue } from "../../../helper/theme";
|
4
|
+
import useWindowResize from "../../../hooks/useWindowResize";
|
5
|
+
import { useEditorContext } from "../../../hooks/useMouseMove";
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
7
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
8
|
+
const LineSpacing = props => {
|
9
|
+
const {
|
10
|
+
value: val,
|
11
|
+
data,
|
12
|
+
onChange
|
13
|
+
} = props;
|
14
|
+
const {
|
15
|
+
theme
|
16
|
+
} = useEditorContext();
|
17
|
+
const {
|
18
|
+
key
|
19
|
+
} = data;
|
20
|
+
const [size] = useWindowResize();
|
21
|
+
const pro_value = getBreakPointsValue(val, size?.device);
|
22
|
+
const [value, setValue] = useState(pro_value);
|
23
|
+
let breakpointValue = getBreakPointsValue(val, null);
|
24
|
+
breakpointValue = typeof breakpointValue['lg'] === 'object' ? breakpointValue['lg'] : breakpointValue;
|
25
|
+
useState(() => {
|
26
|
+
setValue(pro_value);
|
27
|
+
}, [pro_value]);
|
28
|
+
const handleChange = e => {
|
29
|
+
onChange({
|
30
|
+
[key]: {
|
31
|
+
...breakpointValue,
|
32
|
+
[size?.device]: e.target.value
|
33
|
+
}
|
34
|
+
});
|
35
|
+
};
|
36
|
+
return /*#__PURE__*/_jsxs(Grid, {
|
37
|
+
item: true,
|
38
|
+
xs: 12,
|
39
|
+
children: [/*#__PURE__*/_jsx(Typography, {
|
40
|
+
variant: "body1",
|
41
|
+
color: "primary",
|
42
|
+
style: {
|
43
|
+
fontSize: "14px",
|
44
|
+
fontWeight: 500
|
45
|
+
},
|
46
|
+
children: data?.label
|
47
|
+
}), /*#__PURE__*/_jsxs(Grid, {
|
48
|
+
container: true,
|
49
|
+
wrap: "nowrap",
|
50
|
+
className: "sld-wrpr",
|
51
|
+
children: [/*#__PURE__*/_jsx(Slider, {
|
52
|
+
className: "spacingSlider",
|
53
|
+
defaultValue: value || 1.43,
|
54
|
+
"aria-label": "Default",
|
55
|
+
valueLabelDisplay: "auto",
|
56
|
+
min: 0.5,
|
57
|
+
max: 3.0,
|
58
|
+
step: 0.1,
|
59
|
+
name: "lineHeight",
|
60
|
+
onChange: handleChange
|
61
|
+
}), /*#__PURE__*/_jsx(Box, {
|
62
|
+
component: "input",
|
63
|
+
sx: {
|
64
|
+
background: theme?.palette?.editor?.background,
|
65
|
+
color: theme?.palette?.editor?.textColor
|
66
|
+
},
|
67
|
+
name: "lineHeight",
|
68
|
+
value: pro_value,
|
69
|
+
className: "sliderInput",
|
70
|
+
onChange: handleChange,
|
71
|
+
type: "number",
|
72
|
+
placeholder: "0",
|
73
|
+
disabled: true,
|
74
|
+
defaultValue: pro_value || 1.43
|
75
|
+
})]
|
76
|
+
})]
|
77
|
+
});
|
78
|
+
};
|
79
|
+
export default LineSpacing;
|
@@ -49,6 +49,11 @@ const useCommonStyle = theme => ({
|
|
49
49
|
fontWeight: "500",
|
50
50
|
fontFamily: "Inter, sans-serif"
|
51
51
|
},
|
52
|
+
"& .MuiPaper-root": {
|
53
|
+
border: `unset !important`,
|
54
|
+
borderRadius: '0px',
|
55
|
+
height: 'fit-content'
|
56
|
+
},
|
52
57
|
"& p": {
|
53
58
|
marginBottom: "7px",
|
54
59
|
marginTop: "4px"
|
@@ -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
|
+
};
|