@flozy/editor 5.6.7 → 5.6.9
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 +15 -10
- package/dist/Editor/Editor.css +22 -17
- package/dist/Editor/Elements/Button/EditorButton.js +3 -1
- package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +12 -9
- 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/Signature/SignaturePopup.js +3 -1
- package/dist/Editor/Elements/SimpleText/index.js +8 -1
- package/dist/Editor/Elements/SimpleText/style.js +5 -1
- package/dist/Editor/Elements/Table/DragButton.js +2 -1
- package/dist/Editor/Elements/Table/TableCell.js +4 -2
- package/dist/Editor/Elements/Title/title.js +13 -1
- package/dist/Editor/Elements/Variables/Style.js +20 -2
- package/dist/Editor/Elements/Variables/VariableButton.js +7 -3
- package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +13 -3
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +5 -0
- package/dist/Editor/Toolbar/PopupTool/TemplateCard.js +1 -1
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +45 -0
- package/dist/Editor/common/FontLoader/FontLoader.js +4 -4
- package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +1 -0
- package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +14 -2
- package/dist/Editor/common/RnD/Utils/gridDropItem.js +26 -7
- package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +5 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +10 -2
- 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/common/Uploader.js +8 -0
- package/dist/Editor/commonStyle.js +9 -4
- package/dist/Editor/helper/index.js +2 -2
- package/dist/Editor/helper/theme.js +24 -1
- package/dist/Editor/hooks/useMouseMove.js +5 -2
- package/dist/Editor/plugins/withLayout.js +1 -1
- package/dist/Editor/utils/SlateUtilityFunctions.js +8 -1
- package/dist/Editor/utils/button.js +4 -4
- package/dist/Editor/utils/draftToSlate.js +3 -2
- package/dist/Editor/utils/helper.js +30 -24
- package/dist/Editor/utils/pageSettings.js +14 -2
- package/package.json +1 -1
@@ -26,8 +26,8 @@ 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";
|
30
|
-
import { getInitialValue, handleInsertLastElement, isFreeGrid, isFreeGridFragment,
|
29
|
+
import { getBreakpointLineSpacing, getTRBLBreakPoints } from "./helper/theme";
|
30
|
+
import { getInitialValue, handleInsertLastElement, isFreeGrid, isFreeGridFragment, isRestrictedNode, outsideEditorClickLabel } from "./utils/helper";
|
31
31
|
import useWindowResize from "./hooks/useWindowResize";
|
32
32
|
import PopoverAIInput from "./Elements/AI/PopoverAIInput";
|
33
33
|
import RnDCopy from "./common/RnD/RnDCopy";
|
@@ -96,7 +96,8 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
96
96
|
const editorWrapper = useRef();
|
97
97
|
const mentionsRef = useRef();
|
98
98
|
const convertedContent = draftToSlate({
|
99
|
-
data: content
|
99
|
+
data: content,
|
100
|
+
needLayout: otherProps?.needLayout
|
100
101
|
});
|
101
102
|
const [value, setValue] = useState(convertedContent);
|
102
103
|
const [isInteracted, setIsInteracted] = useState(false);
|
@@ -139,7 +140,8 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
139
140
|
pageColor,
|
140
141
|
color: pageTextColor,
|
141
142
|
pageWidth,
|
142
|
-
maxWidth: pageMaxWidth
|
143
|
+
maxWidth: pageMaxWidth,
|
144
|
+
lineHeight
|
143
145
|
} = pageSt?.pageProps || {
|
144
146
|
bannerSpacing: {
|
145
147
|
left: 0,
|
@@ -166,11 +168,11 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
166
168
|
const debounced = useDebouncedCallback(
|
167
169
|
// function
|
168
170
|
value => {
|
171
|
+
debouncedValue.current = value;
|
169
172
|
const {
|
170
173
|
value: strVal,
|
171
174
|
...restVal
|
172
175
|
} = getOnSaveData(value);
|
173
|
-
debouncedValue.current = value;
|
174
176
|
onSave(strVal, restVal);
|
175
177
|
},
|
176
178
|
// delay in ms
|
@@ -181,7 +183,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
181
183
|
return {
|
182
184
|
value: JSON.stringify(val),
|
183
185
|
text: text,
|
184
|
-
title: serializeToText(title?.children) || "
|
186
|
+
title: serializeToText(title?.children) || ""
|
185
187
|
};
|
186
188
|
};
|
187
189
|
const getPreviewImage = async (needBackground = false, options = {}) => {
|
@@ -330,6 +332,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
330
332
|
onDrawerOpen: onDrawerOpen,
|
331
333
|
ICON_API: "https://assets.agenciflow.com"
|
332
334
|
};
|
335
|
+
const lineH = getBreakpointLineSpacing(lineHeight, breakpoint);
|
333
336
|
const renderElement = useCallback(props => {
|
334
337
|
return /*#__PURE__*/_jsx(Element, {
|
335
338
|
...props,
|
@@ -388,8 +391,8 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
388
391
|
} else if (event.key === "ArrowDown" && otherProps?.tagName !== "Pages") {
|
389
392
|
upDownArrowKeyEvents(event, editor);
|
390
393
|
} else if (event.key === "Backspace") {
|
391
|
-
const
|
392
|
-
if (
|
394
|
+
const isNodeRestricted = isRestrictedNode(event, editor);
|
395
|
+
if (isNodeRestricted) {
|
393
396
|
return;
|
394
397
|
}
|
395
398
|
const {
|
@@ -532,6 +535,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
532
535
|
padding: {
|
533
536
|
...getTRBLBreakPoints(bannerSpacing)
|
534
537
|
},
|
538
|
+
lineHeight: lineH,
|
535
539
|
width: !pageWidth || pageWidth === "fixed" ? fixedWidth : fullWidth,
|
536
540
|
height: viewport.h ? `${viewport.h}px` : `100%`,
|
537
541
|
alignSelf: "center",
|
@@ -539,7 +543,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
539
543
|
transition: "all 0.3s",
|
540
544
|
minHeight: "87%",
|
541
545
|
maxWidth: pageMaxWidth ? `${parseInt(pageMaxWidth)}px !important` : "auto",
|
542
|
-
paddingTop: hasTopBanner() ?
|
546
|
+
paddingTop: hasTopBanner() ? "20px !important" : ""
|
543
547
|
},
|
544
548
|
"data-info": outsideEditorClickLabel,
|
545
549
|
children: [/*#__PURE__*/_jsx(Editable, {
|
@@ -593,8 +597,9 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
593
597
|
setIsTextSelected: setIsTextSelected,
|
594
598
|
customProps: customProps,
|
595
599
|
editorWrapper: editorWrapper
|
596
|
-
}) : null, !readOnly
|
600
|
+
}) : null, !readOnly ? /*#__PURE__*/_jsx(SwitchViewport, {
|
597
601
|
breakpoint: breakpoint,
|
602
|
+
show: showViewport,
|
598
603
|
onChange: b => onSwitchBreakpoint(b)
|
599
604
|
}) : null]
|
600
605
|
})
|
package/dist/Editor/Editor.css
CHANGED
@@ -397,6 +397,12 @@ blockquote {
|
|
397
397
|
padding: 0px 5px 0px 2px !important
|
398
398
|
}
|
399
399
|
|
400
|
+
.signatureActionBtnContainer {
|
401
|
+
display: flex;
|
402
|
+
align-items: center;
|
403
|
+
gap: 1rem;
|
404
|
+
}
|
405
|
+
|
400
406
|
.signature-tab {
|
401
407
|
display: flex;
|
402
408
|
align-items: center;
|
@@ -605,8 +611,8 @@ blockquote {
|
|
605
611
|
display: block !important;
|
606
612
|
}
|
607
613
|
|
608
|
-
.dialog-actions-si .
|
609
|
-
margin-top:
|
614
|
+
.dialog-actions-si .signatureActionBtnContainer {
|
615
|
+
margin-top: 1.4rem;
|
610
616
|
}
|
611
617
|
}
|
612
618
|
|
@@ -989,7 +995,7 @@ blockquote {
|
|
989
995
|
|
990
996
|
.sliderInput {
|
991
997
|
width: 66px !important;
|
992
|
-
padding: 2px
|
998
|
+
padding: 2px 0px 2px 4px;
|
993
999
|
margin-left: 18px;
|
994
1000
|
box-shadow: 0px 4px 16px 0px #0000000d;
|
995
1001
|
border: 1px solid #6f6f6f33;
|
@@ -1257,6 +1263,19 @@ blockquote {
|
|
1257
1263
|
pointer-events: auto;
|
1258
1264
|
}
|
1259
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
|
+
}
|
1260
1279
|
.hideScroll {
|
1261
1280
|
overflow-anchor: none;
|
1262
1281
|
}
|
@@ -1272,20 +1291,6 @@ blockquote {
|
|
1272
1291
|
.hideScroll::-webkit-scrollbar-thumb:hover {
|
1273
1292
|
background: none !important;
|
1274
1293
|
}
|
1275
|
-
@media (max-width: 899px) {
|
1276
|
-
.MuiPopover-root {
|
1277
|
-
z-index: 1302 !important;
|
1278
|
-
}
|
1279
|
-
|
1280
|
-
canvas {
|
1281
|
-
max-width: 100% !important;
|
1282
|
-
}
|
1283
|
-
}
|
1284
|
-
|
1285
|
-
.settingsHeader {
|
1286
|
-
font-size: 14px !important;
|
1287
|
-
font-weight: 500 !important;
|
1288
|
-
}
|
1289
1294
|
|
1290
1295
|
.custom-scroll::-webkit-scrollbar {
|
1291
1296
|
height: .6rem;
|
@@ -162,6 +162,7 @@ const EditorButton = props => {
|
|
162
162
|
display: "inline-flex",
|
163
163
|
color: "rgba(0, 0, 0, 0.54)",
|
164
164
|
marginBottom: "0px !important",
|
165
|
+
...classes.buttonMoreOption,
|
165
166
|
...classes.buttonMoreOption3
|
166
167
|
},
|
167
168
|
...btnProps,
|
@@ -264,11 +265,12 @@ const EditorButton = props => {
|
|
264
265
|
...btnSp,
|
265
266
|
borderStyle: borderStyle || "solid",
|
266
267
|
color: `${textColor || "#FFFFFF"}`,
|
267
|
-
fontSize: textSize || "
|
268
|
+
fontSize: textSize || "12px",
|
268
269
|
fontFamily: fontFamily || "PoppinsRegular",
|
269
270
|
display: "inline-flex",
|
270
271
|
alignItems: "center",
|
271
272
|
position: "relative",
|
273
|
+
lineHeight: 1.43,
|
272
274
|
"& .element-toolbar": {
|
273
275
|
display: "none"
|
274
276
|
},
|
@@ -20,7 +20,7 @@ const useTableStyles = (theme, appTheme) => ({
|
|
20
20
|
"& .fillStroke": {
|
21
21
|
stroke: appTheme?.palette?.editor?.tv_stroke
|
22
22
|
},
|
23
|
-
|
23
|
+
"& path": {
|
24
24
|
stroke: appTheme?.palette?.editor?.tv_text
|
25
25
|
}
|
26
26
|
}
|
@@ -30,7 +30,10 @@ const useTableStyles = (theme, appTheme) => ({
|
|
30
30
|
"& input": {
|
31
31
|
color: appTheme?.palette?.editor?.tv_text_primary,
|
32
32
|
background: "transparent",
|
33
|
-
fontSize:
|
33
|
+
fontSize: "14px"
|
34
|
+
},
|
35
|
+
"& .Mui-disabled": {
|
36
|
+
"-webkit-text-fill-color": `${appTheme?.palette?.editor?.tv_text_primary} !important`
|
34
37
|
}
|
35
38
|
},
|
36
39
|
"& th, tr, td": {
|
@@ -39,19 +42,19 @@ const useTableStyles = (theme, appTheme) => ({
|
|
39
42
|
"& .tv-act-btn": {
|
40
43
|
color: appTheme?.palette?.editor?.tv_text,
|
41
44
|
textTransform: "none",
|
42
|
-
|
45
|
+
"& .MuiButton-startIcon": {
|
43
46
|
background: appTheme?.palette?.editor?.tv_ico_bg,
|
44
|
-
borderRadius:
|
45
|
-
padding:
|
47
|
+
borderRadius: "4px",
|
48
|
+
padding: "4px",
|
46
49
|
"& svg": {
|
47
|
-
width:
|
48
|
-
height:
|
50
|
+
width: "14px",
|
51
|
+
height: "14px"
|
49
52
|
}
|
50
53
|
},
|
51
54
|
"&.ico": {
|
52
55
|
"& svg": {
|
53
56
|
color: appTheme?.palette?.editor?.tv_text,
|
54
|
-
|
57
|
+
"& path": {
|
55
58
|
stroke: appTheme?.palette?.editor?.tv_text
|
56
59
|
}
|
57
60
|
}
|
@@ -60,7 +63,7 @@ const useTableStyles = (theme, appTheme) => ({
|
|
60
63
|
color: appTheme?.palette?.editor?.tv_hover_text,
|
61
64
|
"& svg": {
|
62
65
|
color: appTheme?.palette?.editor?.tv_hover_text,
|
63
|
-
|
66
|
+
"& path": {
|
64
67
|
stroke: appTheme?.palette?.editor?.tv_hover_text
|
65
68
|
}
|
66
69
|
}
|
@@ -49,6 +49,7 @@ const SearchAttachment = props => {
|
|
49
49
|
background: `${theme?.palette?.containers?.slashBrainCardBg} !important`,
|
50
50
|
cursor: 'pointer',
|
51
51
|
margin: '4px 0px',
|
52
|
+
lineHeight: 1.43,
|
52
53
|
"&.MuiPaper-root.MuiPaper-rounded": {
|
53
54
|
borderRadius: "7px !important",
|
54
55
|
paddingTop: '0px !important'
|
@@ -512,7 +512,9 @@ const SignaturePopup = props => {
|
|
512
512
|
})
|
513
513
|
})
|
514
514
|
})]
|
515
|
-
}) : null, /*#__PURE__*/_jsxs(
|
515
|
+
}) : null, /*#__PURE__*/_jsxs(Box, {
|
516
|
+
component: "div",
|
517
|
+
className: "signatureActionBtnContainer",
|
516
518
|
children: [!readOnly ? /*#__PURE__*/_jsx(Button, {
|
517
519
|
onClick: handleClear,
|
518
520
|
className: `secondaryBtn actionBtn deleteBtn deleteButtonSignature`,
|
@@ -5,6 +5,7 @@ import { getPageSettings } from "../../utils/pageSettings";
|
|
5
5
|
import { isTextSelected } from "../../utils/helper";
|
6
6
|
import { useEditorContext } from "../../hooks/useMouseMove";
|
7
7
|
import SimpleTextStyle from "./style";
|
8
|
+
import { getBreakpointLineSpacing } from "../../helper/theme";
|
8
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
9
10
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
10
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
@@ -33,8 +34,14 @@ const SimpleText = props => {
|
|
33
34
|
const {
|
34
35
|
pageColor
|
35
36
|
} = pageSt?.pageProps || {};
|
37
|
+
const {
|
38
|
+
activeBreakPoint
|
39
|
+
} = useEditorContext();
|
40
|
+
const lineHeight = element?.children[0]?.lineHeight;
|
41
|
+
const lineH = getBreakpointLineSpacing(lineHeight, activeBreakPoint);
|
36
42
|
const classes = SimpleTextStyle({
|
37
|
-
pageColor: pageColor || theme?.palette?.editor?.background || "#FFFFFF"
|
43
|
+
pageColor: pageColor || theme?.palette?.editor?.background || "#FFFFFF",
|
44
|
+
lineHeight: lineH
|
38
45
|
});
|
39
46
|
const selected = useSelected();
|
40
47
|
const path = ReactEditor.findPath(editor, element);
|
@@ -1,10 +1,12 @@
|
|
1
1
|
import { invertColor } from "../../helper";
|
2
2
|
const SimpleTextStyle = ({
|
3
|
-
pageColor
|
3
|
+
pageColor,
|
4
|
+
lineHeight
|
4
5
|
}) => ({
|
5
6
|
root: {
|
6
7
|
position: "relative",
|
7
8
|
padding: "0px",
|
9
|
+
lineHeight: lineHeight,
|
8
10
|
"&.dataView": {
|
9
11
|
"& .placeholder-simple-text": {
|
10
12
|
opacity: 0
|
@@ -33,6 +35,8 @@ const SimpleTextStyle = ({
|
|
33
35
|
height: "24px",
|
34
36
|
overflow: "hidden",
|
35
37
|
fontSize: "14px",
|
38
|
+
display: "inline-flex",
|
39
|
+
alignItems: "center",
|
36
40
|
"& .bg-pad-sl": {
|
37
41
|
padding: "2px 4px 2px 4px",
|
38
42
|
background: "transparent",
|
@@ -288,6 +288,8 @@ const TableCell = props => {
|
|
288
288
|
Transforms.select(editor, selection);
|
289
289
|
};
|
290
290
|
const onRowDrag = () => {
|
291
|
+
selectCurrentCell();
|
292
|
+
const [rowNode] = getNodeWithType(editor, "table-row", path);
|
291
293
|
const {
|
292
294
|
children
|
293
295
|
} = rowNode[0] || {};
|
@@ -299,9 +301,10 @@ const TableCell = props => {
|
|
299
301
|
endCellPath: rowEndCell,
|
300
302
|
isDragging: false
|
301
303
|
});
|
302
|
-
selectCurrentCell();
|
303
304
|
};
|
304
305
|
const onColDrag = () => {
|
306
|
+
selectCurrentCell();
|
307
|
+
const [tableNode] = getNodeWithType(editor, "table", path);
|
305
308
|
const [tableData, tablePath] = tableNode;
|
306
309
|
const {
|
307
310
|
rows
|
@@ -313,7 +316,6 @@ const TableCell = props => {
|
|
313
316
|
endCellPath: endColCell,
|
314
317
|
isDragging: false
|
315
318
|
});
|
316
|
-
selectCurrentCell();
|
317
319
|
};
|
318
320
|
const handleToolAction = (value, option, dragType) => {
|
319
321
|
const isRowDrag = dragType === "row";
|
@@ -1,12 +1,24 @@
|
|
1
1
|
import React from "react";
|
2
|
+
import { Text } from "slate";
|
2
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
4
|
+
const isEmptyTextNode = node => {
|
5
|
+
if (Text.isText(node)) {
|
6
|
+
return !node.text.trim();
|
7
|
+
}
|
8
|
+
return false;
|
9
|
+
};
|
3
10
|
const Title = props => {
|
4
11
|
const {
|
12
|
+
element,
|
5
13
|
attributes,
|
6
|
-
children
|
14
|
+
children,
|
15
|
+
customProps
|
7
16
|
} = props;
|
17
|
+
const isEmpty = !customProps?.readOnly && isEmptyTextNode(element?.children[0]) ? "empty" : "";
|
8
18
|
return /*#__PURE__*/_jsx("div", {
|
9
19
|
...attributes,
|
20
|
+
placeholder: "Title",
|
21
|
+
className: `content-editable ${isEmpty}`,
|
10
22
|
style: {
|
11
23
|
fontWeight: "bold",
|
12
24
|
fontSize: "20px"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
const VariableStyles =
|
1
|
+
const VariableStyles = theme => ({
|
2
2
|
variablesItem: {
|
3
3
|
color: "#2563EB",
|
4
4
|
background: "#EEEEEE"
|
@@ -37,8 +37,26 @@ const VariableStyles = () => ({
|
|
37
37
|
"& .MuiMenuItem-root": {
|
38
38
|
color: "#64748B"
|
39
39
|
},
|
40
|
+
"& .MuiPaper-root": {
|
41
|
+
borderRadius: '8px',
|
42
|
+
backgroundColor: `${theme?.palette?.editor?.miniToolBarBackground} !important`
|
43
|
+
},
|
44
|
+
"& .MuiList-root": {
|
45
|
+
padding: '0px'
|
46
|
+
},
|
47
|
+
"& .MuiButtonBase-root": {
|
48
|
+
margin: '6px',
|
49
|
+
borderRadius: '8px',
|
50
|
+
padding: '6px 14px',
|
51
|
+
fontSize: '14px',
|
52
|
+
fontWeight: '400',
|
53
|
+
color: theme?.palette?.editor?.deletePopUpButtonTextColor,
|
54
|
+
"&:hover": {
|
55
|
+
background: `${theme?.palette?.editor?.menuOptionHoverBackground} !important`
|
56
|
+
}
|
57
|
+
},
|
40
58
|
"& .Mui-selected": {
|
41
|
-
backgroundColor:
|
59
|
+
backgroundColor: 'unset !important'
|
42
60
|
}
|
43
61
|
}
|
44
62
|
});
|
@@ -3,11 +3,15 @@ import { useSlateStatic } from "slate-react";
|
|
3
3
|
import { MenuItem, Select } from "@mui/material";
|
4
4
|
import { insertVariables } from "../../utils/variables";
|
5
5
|
import VariableStyles from "./Style";
|
6
|
-
import
|
6
|
+
import KeyboardArrowDownRoundedIcon from '@mui/icons-material/KeyboardArrowDownRounded';
|
7
|
+
import { useEditorContext } from "../../hooks/useMouseMove";
|
7
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
8
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
9
10
|
const VariableButton = props => {
|
10
|
-
const
|
11
|
+
const {
|
12
|
+
theme
|
13
|
+
} = useEditorContext();
|
14
|
+
const classes = VariableStyles(theme);
|
11
15
|
const editor = useSlateStatic();
|
12
16
|
const {
|
13
17
|
options
|
@@ -24,7 +28,7 @@ const VariableButton = props => {
|
|
24
28
|
value: "",
|
25
29
|
sx: classes.variableBtn,
|
26
30
|
onChange: updateVariable,
|
27
|
-
IconComponent: () => /*#__PURE__*/_jsx(
|
31
|
+
IconComponent: () => /*#__PURE__*/_jsx(KeyboardArrowDownRoundedIcon, {}),
|
28
32
|
MenuProps: {
|
29
33
|
sx: classes.variableMenuItem,
|
30
34
|
PaperProps: {
|
@@ -98,12 +98,22 @@ const AddTemplates = props => {
|
|
98
98
|
setCategory(newValue);
|
99
99
|
setFilteredTemplates(templates.filter(f => f.category === newValue));
|
100
100
|
};
|
101
|
-
const onSelectTemplate = card => () => {
|
101
|
+
const onSelectTemplate = card => async () => {
|
102
102
|
try {
|
103
|
-
|
103
|
+
const {
|
104
|
+
data
|
105
|
+
} = await services("templateContent", {
|
106
|
+
id: card?.id
|
107
|
+
});
|
108
|
+
const content = data?.content;
|
109
|
+
if (content) {
|
110
|
+
editor.insertNode(JSON.parse(content));
|
111
|
+
} else {
|
112
|
+
console.log("No data found");
|
113
|
+
}
|
104
114
|
onClose();
|
105
115
|
} catch (err) {
|
106
|
-
console.log(err);
|
116
|
+
console.log("Error inserting template content into editor:", err);
|
107
117
|
}
|
108
118
|
};
|
109
119
|
const filterByTitle = f => {
|
@@ -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"
|
@@ -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,
|
@@ -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) {
|