@flozy/editor 5.5.2 → 5.5.4
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 +7 -3
- package/dist/Editor/Editor.css +17 -15
- package/dist/Editor/Elements/Button/EditorButton.js +3 -1
- 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/SimpleText/index.js +11 -3
- package/dist/Editor/Elements/SimpleText/style.js +5 -1
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +10 -0
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +45 -0
- package/dist/Editor/common/FontLoader/FontList.js +3 -0
- package/dist/Editor/common/FontLoader/FontLoader.js +9 -6
- package/dist/Editor/common/MentionsPopup/Styles.js +1 -0
- 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 +9 -6
- 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 +4 -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/utils/SlateUtilityFunctions.js +8 -1
- package/dist/Editor/utils/button.js +4 -4
- package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +51 -7
- package/dist/Editor/utils/helper.js +19 -16
- package/dist/Editor/utils/pageSettings.js +14 -2
- package/package.json +1 -1
@@ -26,7 +26,7 @@ import editorStyles from "./Styles/EditorStyles";
|
|
26
26
|
import DragAndDrop from "./common/DnD";
|
27
27
|
import Section from "./common/Section";
|
28
28
|
import decorators from "./utils/Decorators";
|
29
|
-
import { getTRBLBreakPoints } from "./helper/theme";
|
29
|
+
import { getBreakpointLineSpacing, getTRBLBreakPoints } from "./helper/theme";
|
30
30
|
import { getInitialValue, handleInsertLastElement, isFreeGrid, isFreeGridFragment, isPageSettings, outsideEditorClickLabel } from "./utils/helper";
|
31
31
|
import useWindowResize from "./hooks/useWindowResize";
|
32
32
|
import PopoverAIInput from "./Elements/AI/PopoverAIInput";
|
@@ -139,7 +139,8 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
139
139
|
pageColor,
|
140
140
|
color: pageTextColor,
|
141
141
|
pageWidth,
|
142
|
-
maxWidth: pageMaxWidth
|
142
|
+
maxWidth: pageMaxWidth,
|
143
|
+
lineHeight
|
143
144
|
} = pageSt?.pageProps || {
|
144
145
|
bannerSpacing: {
|
145
146
|
left: 0,
|
@@ -332,6 +333,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
332
333
|
onDrawerOpen: onDrawerOpen,
|
333
334
|
ICON_API: "https://assets.agenciflow.com"
|
334
335
|
};
|
336
|
+
const lineH = getBreakpointLineSpacing(lineHeight, breakpoint);
|
335
337
|
const renderElement = useCallback(props => {
|
336
338
|
return /*#__PURE__*/_jsx(Element, {
|
337
339
|
...props,
|
@@ -534,6 +536,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
534
536
|
padding: {
|
535
537
|
...getTRBLBreakPoints(bannerSpacing)
|
536
538
|
},
|
539
|
+
lineHeight: lineH,
|
537
540
|
width: !pageWidth || pageWidth === "fixed" ? fixedWidth : fullWidth,
|
538
541
|
height: viewport.h ? `${viewport.h}px` : `100%`,
|
539
542
|
alignSelf: "center",
|
@@ -594,8 +597,9 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
594
597
|
setIsTextSelected: setIsTextSelected,
|
595
598
|
customProps: customProps,
|
596
599
|
editorWrapper: editorWrapper
|
597
|
-
}) : null, !readOnly
|
600
|
+
}) : null, !readOnly ? /*#__PURE__*/_jsx(SwitchViewport, {
|
598
601
|
breakpoint: breakpoint,
|
602
|
+
show: showViewport,
|
599
603
|
onChange: b => onSwitchBreakpoint(b)
|
600
604
|
}) : null]
|
601
605
|
})
|
package/dist/Editor/Editor.css
CHANGED
@@ -18,7 +18,10 @@
|
|
18
18
|
.ml-1 {
|
19
19
|
margin-left: 10px;
|
20
20
|
}
|
21
|
-
|
21
|
+
.m-0
|
22
|
+
{
|
23
|
+
margin: 0px
|
24
|
+
}
|
22
25
|
.dflex {
|
23
26
|
display: flex;
|
24
27
|
}
|
@@ -1254,6 +1257,19 @@ blockquote {
|
|
1254
1257
|
pointer-events: auto;
|
1255
1258
|
}
|
1256
1259
|
|
1260
|
+
@media (max-width: 899px) {
|
1261
|
+
.MuiPopover-root {
|
1262
|
+
z-index: 1302 !important;
|
1263
|
+
}
|
1264
|
+
canvas {
|
1265
|
+
max-width: 100% !important;
|
1266
|
+
}
|
1267
|
+
}
|
1268
|
+
|
1269
|
+
.settingsHeader {
|
1270
|
+
font-size: 14px !important;
|
1271
|
+
font-weight: 500 !important;
|
1272
|
+
}
|
1257
1273
|
.hideScroll {
|
1258
1274
|
overflow-anchor: none;
|
1259
1275
|
}
|
@@ -1269,20 +1285,6 @@ blockquote {
|
|
1269
1285
|
.hideScroll::-webkit-scrollbar-thumb:hover {
|
1270
1286
|
background: none !important;
|
1271
1287
|
}
|
1272
|
-
@media (max-width: 899px) {
|
1273
|
-
.MuiPopover-root {
|
1274
|
-
z-index: 1302 !important;
|
1275
|
-
}
|
1276
|
-
|
1277
|
-
canvas {
|
1278
|
-
max-width: 100% !important;
|
1279
|
-
}
|
1280
|
-
}
|
1281
|
-
|
1282
|
-
.settingsHeader {
|
1283
|
-
font-size: 14px !important;
|
1284
|
-
font-weight: 500 !important;
|
1285
|
-
}
|
1286
1288
|
|
1287
1289
|
.custom-scroll::-webkit-scrollbar {
|
1288
1290
|
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
|
},
|
@@ -49,6 +49,7 @@ const SearchAttachment = props => {
|
|
49
49
|
background: theme?.palette?.containers?.slashBrainCardBg,
|
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'
|
@@ -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";
|
@@ -20,7 +21,8 @@ const SimpleText = props => {
|
|
20
21
|
attributes,
|
21
22
|
children,
|
22
23
|
customProps,
|
23
|
-
isEmpty
|
24
|
+
isEmpty,
|
25
|
+
isChatEditor = false
|
24
26
|
} = props;
|
25
27
|
const {
|
26
28
|
readOnly,
|
@@ -32,12 +34,18 @@ const SimpleText = props => {
|
|
32
34
|
const {
|
33
35
|
pageColor
|
34
36
|
} = pageSt?.pageProps || {};
|
37
|
+
const {
|
38
|
+
activeBreakPoint
|
39
|
+
} = useEditorContext();
|
40
|
+
const lineHeight = element?.children[0]?.lineHeight;
|
41
|
+
const lineH = getBreakpointLineSpacing(lineHeight, activeBreakPoint);
|
35
42
|
const classes = SimpleTextStyle({
|
36
|
-
pageColor: pageColor || theme?.palette?.editor?.background || "#FFFFFF"
|
43
|
+
pageColor: pageColor || theme?.palette?.editor?.background || "#FFFFFF",
|
44
|
+
lineHeight: lineH
|
37
45
|
});
|
38
46
|
const selected = useSelected();
|
39
47
|
const path = ReactEditor.findPath(editor, element);
|
40
|
-
const showPlaceHolder = !readOnly && path.length === 1 && isEmpty;
|
48
|
+
const showPlaceHolder = !readOnly && path.length === 1 && isEmpty && !isChatEditor;
|
41
49
|
const isEmptyEditor = !readOnly && isEmpty && editor.children.length === 1 && !selected;
|
42
50
|
const opacity = !isTextSelected(editor?.selection);
|
43
51
|
const nextType = element?.children[0]?.type;
|
@@ -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",
|
@@ -185,6 +185,11 @@ const usePopupStyle = theme => ({
|
|
185
185
|
justifyContent: "start",
|
186
186
|
borderRadius: "10px !important",
|
187
187
|
transition: "background-color 0.3s ease",
|
188
|
+
// "& .colorBoxElementIcon": {
|
189
|
+
// "& path": {
|
190
|
+
// fill: theme?.palette?.type === "dark" ? "none" : "",
|
191
|
+
// },
|
192
|
+
// },
|
188
193
|
"& .signatureElementIcon": {
|
189
194
|
"& path": {
|
190
195
|
fill: `${theme?.palette?.editor?.closeButtonSvgStroke}`
|
@@ -411,6 +416,11 @@ const usePopupStyle = theme => ({
|
|
411
416
|
"& .MuiOutlinedInput-notchedOutline": {
|
412
417
|
border: `1px solid ${theme?.palette?.editor?.inputFieldBorder} !important`
|
413
418
|
},
|
419
|
+
'& .MuiInputBase-root': {
|
420
|
+
'& input': {
|
421
|
+
border: "none !important"
|
422
|
+
}
|
423
|
+
},
|
414
424
|
"& svg": {
|
415
425
|
width: "20px",
|
416
426
|
height: "24px"
|
@@ -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,
|
@@ -0,0 +1,3 @@
|
|
1
|
+
export const defaultFonts = ["EB Garamond", "Anton", "DM Serif Text", "Libre Baskerville", "Montserrat", "Open Sans", "Public Sans", "Raleway", "Space Mono", "Great Vibes", "Zeyada", "Allura", "Pinyon Script", "Dancing Script", "Gaegu", "Kite One", "Merriweather"];
|
2
|
+
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"];
|
3
|
+
export const googleFontList = ["Roboto", "Noto Sans JP", "Poppins", "Lato", "Inter", "Material Icons", "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", "Material Symbols Outlined", "PT Serif", "Material Icons Outlined", "Karla", "Titillium Web", "Heebo", "Noto Serif", "Nanum Gothic", "Noto Color Emoji", "Agdasima", "Bebas Neue", "Libre Franklin", "Mukta", "Material Symbols Rounded", "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", "Source Sans 3", "Hind", "Material Icons Round", "Exo 2", "Teko", "Oxygen", "Cairo", "Crimson Text", "Plus Jakarta Sans", "Overpass", "Pacifico", "Prompt", "Red Hat Display", "Varela Round", "Cormorant Garamond", "Assistant", "Comfortaa", "Lexend", "Signika Negative", "M PLUS Rounded 1c", "Fjalla One", "Material Icons Sharp", "Caveat", "IBM Plex Mono", "Arvo", "Lobster", "Schibsted Grotesk", "Chakra Petch", "Maven Pro", "Sora", "Kalam", "Onest", "Space Grotesk", "Outfit", 'Titillium Web', ...defaultFonts];
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { useEffect } from "react";
|
2
2
|
import WebFont from "webfontloader";
|
3
3
|
import { useEditorContext } from "../../hooks/useMouseMove";
|
4
|
-
|
4
|
+
import { defaultFonts, googleFontList, otherFonts } from "./FontList";
|
5
5
|
const FontLoader = props => {
|
6
6
|
const {
|
7
7
|
otherProps,
|
@@ -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();
|
@@ -54,7 +54,7 @@ const FontLoader = props => {
|
|
54
54
|
loadNextBatch();
|
55
55
|
};
|
56
56
|
useEffect(() => {
|
57
|
-
let families = [...defaultFonts];
|
57
|
+
let families = [...otherFonts, ...defaultFonts];
|
58
58
|
if (!readOnly) {
|
59
59
|
otherProps?.services("listGoogleFont", []).then(data => {
|
60
60
|
families = [...families, ...(data?.data || [])];
|
@@ -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) {
|
@@ -86,9 +86,12 @@ const FontLoader = props => {
|
|
86
86
|
fontSet.add(sanitizeFontFamily(computedStyles?.fontFamily));
|
87
87
|
});
|
88
88
|
let families = Array.from(fontSet);
|
89
|
+
families = families.filter(font => googleFontList.includes(font));
|
90
|
+
console.log("🚀 2 ~ useEffect ~ families:", families);
|
89
91
|
families = correctFontArray(families.join(", "));
|
90
92
|
families = families?.map(font => font?.replace(/\"/g, ""));
|
91
93
|
families = families?.map(font => font?.replace(", sans-serif", "")); //This is temporary fix for patch
|
94
|
+
console.log("🚀 ~ useEffect ~ families:", families);
|
92
95
|
loadFontsInBatches(families);
|
93
96
|
}
|
94
97
|
}, []);
|
@@ -3,24 +3,35 @@ 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 => {
|
9
10
|
const {
|
10
11
|
breakpoint,
|
11
|
-
onChange
|
12
|
+
onChange,
|
13
|
+
show
|
12
14
|
} = props;
|
13
15
|
const classes = useSwitchViewport();
|
16
|
+
const {
|
17
|
+
setSelectedElement,
|
18
|
+
setActiveBreakPoint
|
19
|
+
} = useEditorContext();
|
14
20
|
useEffect(() => {
|
15
|
-
|
21
|
+
// to reset selection on viewport changes - FS-6589
|
22
|
+
setSelectedElement({});
|
16
23
|
}, [breakpoint]);
|
17
24
|
return /*#__PURE__*/_jsxs(Box, {
|
18
25
|
sx: classes.root,
|
26
|
+
style: {
|
27
|
+
display: show ? "block" : "none"
|
28
|
+
},
|
19
29
|
children: [/*#__PURE__*/_jsx(Tooltip, {
|
20
30
|
title: "Desktop View",
|
21
31
|
children: /*#__PURE__*/_jsx(IconButton, {
|
22
32
|
className: `${!breakpoint || breakpoint === "lg" ? "active" : ""}`,
|
23
33
|
onClick: () => {
|
34
|
+
setActiveBreakPoint("");
|
24
35
|
onChange("");
|
25
36
|
},
|
26
37
|
children: /*#__PURE__*/_jsx(PersonalVideoIcon, {})
|
@@ -30,6 +41,7 @@ const SwitchViewport = props => {
|
|
30
41
|
children: /*#__PURE__*/_jsx(IconButton, {
|
31
42
|
className: `${breakpoint === "xs" ? "active" : ""}`,
|
32
43
|
onClick: () => {
|
44
|
+
setActiveBreakPoint("xs");
|
33
45
|
onChange("xs");
|
34
46
|
},
|
35
47
|
children: /*#__PURE__*/_jsx(PhoneIphoneIcon, {})
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { Transforms, Node, Path } from "slate";
|
2
2
|
import { ReactEditor } from "slate-react";
|
3
|
+
import { handleNegativeInteger } from "../../../utils/helper";
|
3
4
|
export const ROW_HEIGHT = 50;
|
4
5
|
const MARGIN_OF = {
|
5
6
|
xs: 160,
|
@@ -75,7 +76,7 @@ const reRenderChildNodes = (editor, path) => {
|
|
75
76
|
console.log(err);
|
76
77
|
}
|
77
78
|
};
|
78
|
-
function isContainerElement(editor, moveTopath, props) {
|
79
|
+
function isContainerElement(editor, moveTopath, props, appenBp) {
|
79
80
|
try {
|
80
81
|
const {
|
81
82
|
path,
|
@@ -91,6 +92,7 @@ function isContainerElement(editor, moveTopath, props) {
|
|
91
92
|
parentNode = Node.get(editor, Path.parent(dragItemPath));
|
92
93
|
}
|
93
94
|
const moveToNode = Node.get(editor, moveTopath);
|
95
|
+
const leftOfMoveToNode = moveToNode[`left${appenBp}`];
|
94
96
|
if (moveToNode.type === "freegridBox") {
|
95
97
|
if (parentNode.type === "freegridBox") {
|
96
98
|
// same box
|
@@ -98,10 +100,10 @@ function isContainerElement(editor, moveTopath, props) {
|
|
98
100
|
return props.calX;
|
99
101
|
} else {
|
100
102
|
// for different box
|
101
|
-
return parseInt(props.x - window.innerWidth / 2 + MARGIN_OF[props.breakpoint] - props.diffX -
|
103
|
+
return parseInt(props.x - window.innerWidth / 2 + MARGIN_OF[props.breakpoint] - props.diffX - leftOfMoveToNode);
|
102
104
|
}
|
103
105
|
} else {
|
104
|
-
return props.calX -
|
106
|
+
return props.calX - leftOfMoveToNode;
|
105
107
|
}
|
106
108
|
} else if (moveToNode.type === "freegrid") {
|
107
109
|
if (parentNode.type === "freegridBox") {
|
@@ -133,14 +135,16 @@ export function onDropItem(props, parentClass) {
|
|
133
135
|
const from = parentPath.split("|").map(m => parseInt(m));
|
134
136
|
let newPath = [];
|
135
137
|
newPath = moveTo;
|
136
|
-
const
|
138
|
+
const appenBp = breakpoint === "lg" ? "" : `_${breakpoint}`;
|
139
|
+
const cCalx = isContainerElement(editor, moveTo, props, appenBp);
|
140
|
+
|
137
141
|
// const posX = parseInt(
|
138
142
|
// cx - window.innerWidth / 2 + MARGIN_OF[breakpoint] - diffX
|
139
143
|
// );
|
140
144
|
const toSectionNode = Node.get(editor, newPath);
|
141
145
|
const addToSectionDOM = ReactEditor.toDOMNode(editor, toSectionNode);
|
142
146
|
const rect = addToSectionDOM.getBoundingClientRect();
|
143
|
-
const y = endPosition.y - startPosition.diffY - rect.top;
|
147
|
+
const y = handleNegativeInteger(endPosition.y - startPosition.diffY - rect.top);
|
144
148
|
|
145
149
|
// Calculate grid position
|
146
150
|
const row = Math.floor(y / ROW_HEIGHT) + 1;
|
@@ -150,7 +154,6 @@ export function onDropItem(props, parentClass) {
|
|
150
154
|
|
151
155
|
// Update grid area
|
152
156
|
const gridArea = `${row} / 1 / ${row + 1} / 2`;
|
153
|
-
const appenBp = breakpoint === "lg" ? "" : `_${breakpoint}`;
|
154
157
|
Transforms.setNodes(editor, {
|
155
158
|
[`gridArea${appenBp}`]: gridArea,
|
156
159
|
[`left${appenBp}`]: cCalx,
|
@@ -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
|
}
|
@@ -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;
|
@@ -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",
|
@@ -464,10 +464,6 @@ const useCommonStyle = theme => ({
|
|
464
464
|
}
|
465
465
|
}
|
466
466
|
},
|
467
|
-
pageSettingPopUpRoot: {
|
468
|
-
padding: "16px 8px 16px 10px!important",
|
469
|
-
height: "100%"
|
470
|
-
},
|
471
467
|
buttonMoreOption: {
|
472
468
|
background: `${theme?.palette?.editor?.aiInputBackground} !important`,
|
473
469
|
border: `1px solid ${theme?.palette?.editor?.buttonBorder1} !important`,
|
@@ -480,6 +476,10 @@ const useCommonStyle = theme => ({
|
|
480
476
|
}
|
481
477
|
}
|
482
478
|
},
|
479
|
+
pageSettingPopUpRoot: {
|
480
|
+
padding: "16px 8px 16px 10px!important",
|
481
|
+
height: "100%"
|
482
|
+
},
|
483
483
|
buttonMoreOption2: {
|
484
484
|
background: `${theme?.palette?.editor?.aiInputBackground} !important`,
|
485
485
|
border: `1px solid ${theme?.palette?.editor?.buttonBorder1} !important`,
|
@@ -337,14 +337,14 @@ export const isCarouselSelected = editor => {
|
|
337
337
|
return false;
|
338
338
|
}
|
339
339
|
const [nodeEntry] = Editor.nodes(editor, {
|
340
|
-
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type ===
|
340
|
+
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "carousel"
|
341
341
|
});
|
342
342
|
if (!nodeEntry) {
|
343
343
|
return false;
|
344
344
|
}
|
345
345
|
const [node] = nodeEntry;
|
346
346
|
const carouselDom = ReactEditor.toDOMNode(editor, node);
|
347
|
-
const isEdit = carouselDom.classList.contains(
|
347
|
+
const isEdit = carouselDom.classList.contains("carousel_slider_edit");
|
348
348
|
return !isEdit;
|
349
349
|
} catch (err) {
|
350
350
|
console.log(err);
|
@@ -147,4 +147,27 @@ export const groupByBreakpoint = (styleProps, theme) => {
|
|
147
147
|
}
|
148
148
|
};
|
149
149
|
};
|
150
|
-
export const getCustomizationValue = value => isNaN(parseInt(value)) ? null : parseInt(value);
|
150
|
+
export const getCustomizationValue = value => isNaN(parseInt(value)) ? null : parseInt(value);
|
151
|
+
export const getBreakpointLineSpacing = (value, breakpoint) => {
|
152
|
+
try {
|
153
|
+
const values = getBreakPointsValue(value, breakpoint);
|
154
|
+
const cssVal = BREAKPOINTS_DEVICES.reduce((a, b) => {
|
155
|
+
if (values[b] || values["lg"]) {
|
156
|
+
const value = values[b] || values["lg"];
|
157
|
+
return {
|
158
|
+
...a,
|
159
|
+
[b]: value
|
160
|
+
};
|
161
|
+
} else {
|
162
|
+
return a;
|
163
|
+
}
|
164
|
+
}, {});
|
165
|
+
if (breakpoint) {
|
166
|
+
return value[breakpoint] || value["lg"] || value;
|
167
|
+
} else {
|
168
|
+
return cssVal["lg"];
|
169
|
+
}
|
170
|
+
} catch (err) {
|
171
|
+
// console.log(err);
|
172
|
+
}
|
173
|
+
};
|
@@ -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
|
@@ -314,7 +314,8 @@ export const getBlock = props => {
|
|
314
314
|
borderRadius: `${element?.color ? "0px" : "12px"} 12px 12px ${element?.color ? "0px" : "12px"}`,
|
315
315
|
margin: `${element?.bgColor ? "16px" : "0px"} 0px`,
|
316
316
|
width: element?.bgColor ? "calc(100% - 16px)" : "100%",
|
317
|
-
borderWidth: element?.color ? "0px 0px 0px 3px" : "0px"
|
317
|
+
borderWidth: element?.color ? "0px 0px 0px 3px" : "0px",
|
318
|
+
lineHeight: 1.43
|
318
319
|
},
|
319
320
|
children: children
|
320
321
|
});
|
@@ -374,6 +375,9 @@ export const getBlock = props => {
|
|
374
375
|
});
|
375
376
|
case "orderedList":
|
376
377
|
return /*#__PURE__*/_jsx("ol", {
|
378
|
+
style: {
|
379
|
+
lineHeight: 1.43
|
380
|
+
},
|
377
381
|
className: "listItemMargin",
|
378
382
|
type: "1",
|
379
383
|
...attributes,
|
@@ -381,6 +385,9 @@ export const getBlock = props => {
|
|
381
385
|
});
|
382
386
|
case "unorderedList":
|
383
387
|
return /*#__PURE__*/_jsx("ul", {
|
388
|
+
style: {
|
389
|
+
lineHeight: 1.43
|
390
|
+
},
|
384
391
|
className: "listItemMargin",
|
385
392
|
...attributes,
|
386
393
|
children: children
|
@@ -237,24 +237,30 @@ export const getBlock = props => {
|
|
237
237
|
return /*#__PURE__*/_jsx("p", {
|
238
238
|
...attributes,
|
239
239
|
...element.attr,
|
240
|
-
className: `content-editable ${isEmpty ? "empty" : ""}`
|
240
|
+
className: `content-editable ${isEmpty ? "empty" : ""} m-0`
|
241
241
|
// placeholder="paragraph"
|
242
242
|
,
|
243
243
|
children: children
|
244
244
|
});
|
245
245
|
case "headingOne":
|
246
|
-
return /*#__PURE__*/_jsx("
|
246
|
+
return /*#__PURE__*/_jsx("h3", {
|
247
247
|
...attributes,
|
248
248
|
...element.attr,
|
249
|
+
style: {
|
250
|
+
margin: "10px 0px"
|
251
|
+
},
|
249
252
|
className: `content-editable ${isEmpty ? "empty" : ""}`
|
250
253
|
// placeholder="Heading 1"
|
251
254
|
,
|
252
255
|
children: children
|
253
256
|
});
|
254
257
|
case "headingTwo":
|
255
|
-
return /*#__PURE__*/_jsx("
|
258
|
+
return /*#__PURE__*/_jsx("h3", {
|
256
259
|
...attributes,
|
257
260
|
...element.attr,
|
261
|
+
style: {
|
262
|
+
margin: "10px 0px"
|
263
|
+
},
|
258
264
|
className: `content-editable ${isEmpty ? "empty" : ""}`
|
259
265
|
// placeholder="Heading 2"
|
260
266
|
,
|
@@ -264,18 +270,55 @@ export const getBlock = props => {
|
|
264
270
|
return /*#__PURE__*/_jsx("h3", {
|
265
271
|
...attributes,
|
266
272
|
...element.attr,
|
267
|
-
|
273
|
+
style: {
|
274
|
+
margin: "10px 0px"
|
275
|
+
},
|
276
|
+
className: `content-editable ${isEmpty ? "empty" : ""} m-0`,
|
268
277
|
children: children
|
269
278
|
});
|
270
279
|
case "headingThree":
|
271
280
|
return /*#__PURE__*/_jsx("h3", {
|
272
281
|
...attributes,
|
273
282
|
...element.attr,
|
283
|
+
style: {
|
284
|
+
margin: "10px 0px"
|
285
|
+
},
|
274
286
|
className: `content-editable ${isEmpty ? "empty" : ""}`
|
275
287
|
// placeholder="Heading 3"
|
276
288
|
,
|
277
289
|
children: children
|
278
290
|
});
|
291
|
+
case "headingFour":
|
292
|
+
return /*#__PURE__*/_jsx("h4", {
|
293
|
+
...attributes,
|
294
|
+
...element.attr,
|
295
|
+
style: {
|
296
|
+
margin: "10px 0px"
|
297
|
+
},
|
298
|
+
className: `content-editable ${isEmpty ? "empty" : ""}`,
|
299
|
+
children: children
|
300
|
+
});
|
301
|
+
case "headingFive":
|
302
|
+
return /*#__PURE__*/_jsx("h5", {
|
303
|
+
...attributes,
|
304
|
+
...element.attr,
|
305
|
+
className: `content-editable ${isEmpty ? "empty" : ""} m-0`,
|
306
|
+
children: children
|
307
|
+
});
|
308
|
+
case "headingSix":
|
309
|
+
return /*#__PURE__*/_jsx("h6", {
|
310
|
+
...attributes,
|
311
|
+
...element.attr,
|
312
|
+
className: `content-editable ${isEmpty ? "empty" : ""}`,
|
313
|
+
children: children
|
314
|
+
});
|
315
|
+
case "headingSeven":
|
316
|
+
return /*#__PURE__*/_jsx("h7", {
|
317
|
+
...attributes,
|
318
|
+
...element.attr,
|
319
|
+
className: `content-editable ${isEmpty ? "empty" : ""} m-0`,
|
320
|
+
children: children
|
321
|
+
});
|
279
322
|
case "blockquote":
|
280
323
|
return /*#__PURE__*/_jsx("blockquote", {
|
281
324
|
...attributes,
|
@@ -327,7 +370,7 @@ export const getBlock = props => {
|
|
327
370
|
return /*#__PURE__*/_jsx("li", {
|
328
371
|
...attributes,
|
329
372
|
...element.attr,
|
330
|
-
className: `content-editable ${isEmpty ? "empty" : ""}`,
|
373
|
+
className: `content-editable ${isEmpty ? "empty" : ""} m-0`,
|
331
374
|
placeholder: "List",
|
332
375
|
style: {
|
333
376
|
color: firstChildren?.color
|
@@ -344,7 +387,7 @@ export const getBlock = props => {
|
|
344
387
|
return /*#__PURE__*/_jsx("p", {
|
345
388
|
...attributes,
|
346
389
|
...element.attr,
|
347
|
-
className: `content-editable ${isEmpty ? "empty" : ""}`
|
390
|
+
className: `content-editable ${isEmpty ? "empty" : ""} m-0`
|
348
391
|
// placeholder="paragraph"
|
349
392
|
,
|
350
393
|
children: children
|
@@ -366,7 +409,8 @@ export const getBlock = props => {
|
|
366
409
|
default:
|
367
410
|
return /*#__PURE__*/_jsx(SimpleText, {
|
368
411
|
...props,
|
369
|
-
isEmpty: isEmpty
|
412
|
+
isEmpty: isEmpty,
|
413
|
+
isChatEditor: true
|
370
414
|
});
|
371
415
|
}
|
372
416
|
};
|
@@ -624,6 +624,10 @@ export const isPageSettings = (event, editor) => {
|
|
624
624
|
return isPageSettingsNode;
|
625
625
|
}
|
626
626
|
};
|
627
|
+
export function capitalizeFirstLetter(str) {
|
628
|
+
if (!str) return str;
|
629
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
630
|
+
}
|
627
631
|
export const insertLineBreakAtEndOfPath = (editor, path) => {
|
628
632
|
try {
|
629
633
|
const [node, nodePath] = Editor.node(editor, path); // Get the node at the specified path
|
@@ -642,6 +646,13 @@ export const insertLineBreakAtEndOfPath = (editor, path) => {
|
|
642
646
|
console.log(err);
|
643
647
|
}
|
644
648
|
};
|
649
|
+
export function isHavingSelection(editor) {
|
650
|
+
try {
|
651
|
+
return editor?.selection && !Range.isCollapsed(editor.selection);
|
652
|
+
} catch (err) {
|
653
|
+
console.log(err);
|
654
|
+
}
|
655
|
+
}
|
645
656
|
const omitNodes = ["site-settings", "page-settings"];
|
646
657
|
export function getInitialValue(value = [], readOnly) {
|
647
658
|
if (readOnly === "readonly" && value?.length) {
|
@@ -670,20 +681,17 @@ export function getInitialValue(value = [], readOnly) {
|
|
670
681
|
}
|
671
682
|
return value;
|
672
683
|
}
|
673
|
-
export function capitalizeFirstLetter(str) {
|
674
|
-
if (!str) return str;
|
675
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
676
|
-
}
|
677
|
-
export function isHavingSelection(editor) {
|
678
|
-
try {
|
679
|
-
return editor?.selection && !Range.isCollapsed(editor.selection);
|
680
|
-
} catch (err) {
|
681
|
-
console.log(err);
|
682
|
-
}
|
683
|
-
}
|
684
684
|
export function getSelectedCls(defaultCls = "", selected, selectedClsName = "selected") {
|
685
685
|
return `${defaultCls} ${selected ? selectedClsName : ""}`;
|
686
686
|
}
|
687
|
+
export function handleNegativeInteger(val) {
|
688
|
+
return val < 0 ? 0 : val;
|
689
|
+
}
|
690
|
+
export const containsSurrogatePair = text => {
|
691
|
+
// Match surrogate pairs (high and low surrogate)
|
692
|
+
const surrogatePairRegex = /[\uD800-\uDBFF][\uDC00-\uDFFF]/;
|
693
|
+
return surrogatePairRegex.test(text);
|
694
|
+
};
|
687
695
|
export const getNodeWithType = (editor, nodeType = "", otherOptions) => {
|
688
696
|
try {
|
689
697
|
const options = {
|
@@ -697,11 +705,6 @@ export const getNodeWithType = (editor, nodeType = "", otherOptions) => {
|
|
697
705
|
return [];
|
698
706
|
}
|
699
707
|
};
|
700
|
-
export const containsSurrogatePair = text => {
|
701
|
-
// Match surrogate pairs (high and low surrogate)
|
702
|
-
const surrogatePairRegex = /[\uD800-\uDBFF][\uDC00-\uDFFF]/;
|
703
|
-
return surrogatePairRegex.test(text);
|
704
|
-
};
|
705
708
|
export const getSlateDom = (editor, range) => {
|
706
709
|
try {
|
707
710
|
const slateDom = ReactEditor.toDOMRange(editor, range);
|
@@ -9,7 +9,13 @@ export const findPageSettings = editor => {
|
|
9
9
|
path: null,
|
10
10
|
element: {
|
11
11
|
pageProps: {
|
12
|
-
pageWidth: "fixed"
|
12
|
+
pageWidth: "fixed",
|
13
|
+
"lineHeight": {
|
14
|
+
"xs": 1.43,
|
15
|
+
"sm": 1.43,
|
16
|
+
"md": 1.43,
|
17
|
+
"lg": 1.43
|
18
|
+
}
|
13
19
|
}
|
14
20
|
}
|
15
21
|
};
|
@@ -34,7 +40,13 @@ export const getPageSettings = editor => {
|
|
34
40
|
path: null,
|
35
41
|
element: {
|
36
42
|
pageProps: {
|
37
|
-
pageWidth: "fixed"
|
43
|
+
pageWidth: "fixed",
|
44
|
+
"lineHeight": {
|
45
|
+
"xs": 1.43,
|
46
|
+
"sm": 1.43,
|
47
|
+
"md": 1.43,
|
48
|
+
"lg": 1.43
|
49
|
+
}
|
38
50
|
}
|
39
51
|
}
|
40
52
|
};
|