@flozy/editor 5.8.5 → 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/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
@@ -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
|
+
};
|
@@ -161,4 +161,27 @@ export const groupByBreakpoint = (styleProps, theme) => {
|
|
161
161
|
}
|
162
162
|
};
|
163
163
|
};
|
164
|
-
export const getCustomizationValue = value => isNaN(parseInt(value)) ? null : parseInt(value);
|
164
|
+
export const getCustomizationValue = value => isNaN(parseInt(value)) ? null : parseInt(value);
|
165
|
+
export const getBreakpointLineSpacing = (value, breakpoint) => {
|
166
|
+
try {
|
167
|
+
const values = getBreakPointsValue(value, breakpoint);
|
168
|
+
const cssVal = BREAKPOINTS_DEVICES.reduce((a, b) => {
|
169
|
+
if (values[b] || values["lg"]) {
|
170
|
+
const value = values[b] || values["lg"];
|
171
|
+
return {
|
172
|
+
...a,
|
173
|
+
[b]: value
|
174
|
+
};
|
175
|
+
} else {
|
176
|
+
return a;
|
177
|
+
}
|
178
|
+
}, {});
|
179
|
+
if (breakpoint) {
|
180
|
+
return value[breakpoint] || value["lg"] || value;
|
181
|
+
} else {
|
182
|
+
return cssVal["lg"];
|
183
|
+
}
|
184
|
+
} catch (err) {
|
185
|
+
// console.log(err);
|
186
|
+
}
|
187
|
+
};
|
@@ -35,6 +35,7 @@ export const EditorProvider = ({
|
|
35
35
|
path: null
|
36
36
|
});
|
37
37
|
const [fontFamilies, setFontFamilies] = useState({});
|
38
|
+
const [activeBreakPoint, setActiveBreakPoint] = useState("");
|
38
39
|
useEffect(() => {
|
39
40
|
window.updateSelectedItem = d => {
|
40
41
|
setSelectedElement(d);
|
@@ -97,8 +98,10 @@ export const EditorProvider = ({
|
|
97
98
|
setOpenAI,
|
98
99
|
updateDragging,
|
99
100
|
fontFamilies,
|
100
|
-
setFontFamilies
|
101
|
-
|
101
|
+
setFontFamilies,
|
102
|
+
activeBreakPoint,
|
103
|
+
setActiveBreakPoint
|
104
|
+
}), [path, editor?.selection, selectedPath, selectedElement, contextMenu, openAI, popupType, drop, activeBreakPoint]);
|
102
105
|
return /*#__PURE__*/_jsx(EditorContext.Provider, {
|
103
106
|
value: otherValues,
|
104
107
|
children: children
|
@@ -173,10 +173,9 @@ export const getMarked = (leaf, children, theme) => {
|
|
173
173
|
if (leaf.highlight) {
|
174
174
|
children = /*#__PURE__*/_jsx("span", {
|
175
175
|
style: {
|
176
|
-
color: "inherit"
|
176
|
+
color: "inherit",
|
177
|
+
background: "var(--slate-highlight-bg)"
|
177
178
|
},
|
178
|
-
className: "slate-highlight" // while opening AI, we will use this element to highlight the selection. (PopoverAIInput.js)
|
179
|
-
,
|
180
179
|
children: children
|
181
180
|
});
|
182
181
|
}
|
@@ -314,7 +313,8 @@ export const getBlock = props => {
|
|
314
313
|
borderRadius: `${element?.color ? "0px" : "12px"} 12px 12px ${element?.color ? "0px" : "12px"}`,
|
315
314
|
margin: `${element?.bgColor ? "16px" : "0px"} 0px`,
|
316
315
|
width: element?.bgColor ? "calc(100% - 16px)" : "100%",
|
317
|
-
borderWidth: element?.color ? "0px 0px 0px 3px" : "0px"
|
316
|
+
borderWidth: element?.color ? "0px 0px 0px 3px" : "0px",
|
317
|
+
lineHeight: 1.43
|
318
318
|
},
|
319
319
|
children: children
|
320
320
|
});
|
@@ -374,6 +374,9 @@ export const getBlock = props => {
|
|
374
374
|
});
|
375
375
|
case "orderedList":
|
376
376
|
return /*#__PURE__*/_jsx("ol", {
|
377
|
+
style: {
|
378
|
+
lineHeight: 1.43
|
379
|
+
},
|
377
380
|
className: "listItemMargin",
|
378
381
|
type: "1",
|
379
382
|
...attributes,
|
@@ -381,6 +384,9 @@ export const getBlock = props => {
|
|
381
384
|
});
|
382
385
|
case "unorderedList":
|
383
386
|
return /*#__PURE__*/_jsx("ul", {
|
387
|
+
style: {
|
388
|
+
lineHeight: 1.43
|
389
|
+
},
|
384
390
|
className: "listItemMargin",
|
385
391
|
...attributes,
|
386
392
|
children: children
|
@@ -43,7 +43,8 @@ const useTableResize = ({
|
|
43
43
|
minWidth
|
44
44
|
} = minMaxProps || {};
|
45
45
|
setSize(currentSize => {
|
46
|
-
const
|
46
|
+
const width = currentSize?.width || parentDOM?.clientWidth;
|
47
|
+
const calcWidth = width + e.movementX;
|
47
48
|
return {
|
48
49
|
width: minWidth && calcWidth < minWidth ? minWidth : calcWidth,
|
49
50
|
height: currentSize.height + e.movementY,
|