@flozy/editor 5.8.7 → 5.8.8
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 +4 -6
- package/dist/Editor/Editor.css +14 -29
- package/dist/Editor/Elements/Button/EditorButton.js +1 -2
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +12 -8
- package/dist/Editor/Elements/Grid/GridItem.js +2 -1
- package/dist/Editor/Elements/Link/Link.js +31 -42
- package/dist/Editor/Elements/SimpleText/style.js +2 -2
- package/dist/Editor/Elements/Title/title.js +1 -13
- package/dist/Editor/Elements/Variables/Style.js +2 -28
- package/dist/Editor/Elements/Variables/VariableButton.js +4 -17
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +0 -5
- package/dist/Editor/common/FontLoader/FontList.js +11 -3
- package/dist/Editor/common/FontLoader/FontLoader.js +7 -33
- package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +0 -1
- package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +2 -8
- package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +0 -5
- package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +2 -10
- package/dist/Editor/common/Uploader.js +0 -8
- package/dist/Editor/common/iconslist.js +2 -1
- package/dist/Editor/commonStyle.js +59 -55
- package/dist/Editor/helper/deserialize/index.js +5 -18
- package/dist/Editor/helper/index.js +2 -2
- package/dist/Editor/plugins/withHTML.js +1 -8
- package/dist/Editor/plugins/withLayout.js +1 -1
- package/dist/Editor/utils/SlateUtilityFunctions.js +0 -31
- package/dist/Editor/utils/button.js +4 -4
- package/dist/Editor/utils/draftToSlate.js +2 -3
- package/dist/Editor/utils/helper.js +20 -20
- package/package.json +2 -3
- package/dist/Editor/helper/markdown.js +0 -45
@@ -96,8 +96,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
96
96
|
const editorWrapper = useRef();
|
97
97
|
const mentionsRef = useRef();
|
98
98
|
const convertedContent = draftToSlate({
|
99
|
-
data: content
|
100
|
-
needLayout: otherProps?.needLayout
|
99
|
+
data: content
|
101
100
|
});
|
102
101
|
const [value, setValue] = useState(convertedContent);
|
103
102
|
const [isInteracted, setIsInteracted] = useState(false);
|
@@ -168,11 +167,11 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
168
167
|
const debounced = useDebouncedCallback(
|
169
168
|
// function
|
170
169
|
value => {
|
171
|
-
debouncedValue.current = value;
|
172
170
|
const {
|
173
171
|
value: strVal,
|
174
172
|
...restVal
|
175
173
|
} = getOnSaveData(value);
|
174
|
+
debouncedValue.current = value;
|
176
175
|
onSave(strVal, restVal);
|
177
176
|
},
|
178
177
|
// delay in ms
|
@@ -183,7 +182,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
183
182
|
return {
|
184
183
|
value: JSON.stringify(val),
|
185
184
|
text: text,
|
186
|
-
title: serializeToText(title?.children) || ""
|
185
|
+
title: serializeToText(title?.children) || "Untitled"
|
187
186
|
};
|
188
187
|
};
|
189
188
|
const getPreviewImage = async (needBackground = false, options = {}) => {
|
@@ -597,9 +596,8 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
597
596
|
setIsTextSelected: setIsTextSelected,
|
598
597
|
customProps: customProps,
|
599
598
|
editorWrapper: editorWrapper
|
600
|
-
}) : null, !readOnly ? /*#__PURE__*/_jsx(SwitchViewport, {
|
599
|
+
}) : null, !readOnly && showViewport ? /*#__PURE__*/_jsx(SwitchViewport, {
|
601
600
|
breakpoint: breakpoint,
|
602
|
-
show: showViewport,
|
603
601
|
onChange: b => onSwitchBreakpoint(b)
|
604
602
|
}) : null]
|
605
603
|
})
|
package/dist/Editor/Editor.css
CHANGED
@@ -1263,19 +1263,6 @@ blockquote {
|
|
1263
1263
|
pointer-events: auto;
|
1264
1264
|
}
|
1265
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
|
-
}
|
1279
1266
|
.hideScroll {
|
1280
1267
|
overflow-anchor: none;
|
1281
1268
|
}
|
@@ -1291,6 +1278,20 @@ blockquote {
|
|
1291
1278
|
.hideScroll::-webkit-scrollbar-thumb:hover {
|
1292
1279
|
background: none !important;
|
1293
1280
|
}
|
1281
|
+
@media (max-width: 899px) {
|
1282
|
+
.MuiPopover-root {
|
1283
|
+
z-index: 1302 !important;
|
1284
|
+
}
|
1285
|
+
|
1286
|
+
canvas {
|
1287
|
+
max-width: 100% !important;
|
1288
|
+
}
|
1289
|
+
}
|
1290
|
+
|
1291
|
+
.settingsHeader {
|
1292
|
+
font-size: 14px !important;
|
1293
|
+
font-weight: 500 !important;
|
1294
|
+
}
|
1294
1295
|
|
1295
1296
|
.custom-scroll::-webkit-scrollbar {
|
1296
1297
|
height: .6rem;
|
@@ -1329,19 +1330,3 @@ blockquote {
|
|
1329
1330
|
background: linear-gradient(112.61deg, #2C63ED 19.3%, #8360FD 88.14%) !important;
|
1330
1331
|
text-transform: math-auto !important;
|
1331
1332
|
}
|
1332
|
-
|
1333
|
-
code.markcode {
|
1334
|
-
border-radius: 4px;
|
1335
|
-
padding: 6px 8px;
|
1336
|
-
margin: 8px 0px;
|
1337
|
-
display: block;
|
1338
|
-
background-color: #f3f3f3;
|
1339
|
-
font-family: 'Source Code Pro' !important;
|
1340
|
-
}
|
1341
|
-
|
1342
|
-
/* Hide the popper when the reference is hidden */
|
1343
|
-
.hide-popper-on-overlap[data-popper-escaped],
|
1344
|
-
.hide-popper-on-overlap[data-popper-reference-hidden] {
|
1345
|
-
visibility: hidden;
|
1346
|
-
pointer-events: none;
|
1347
|
-
}
|
@@ -162,7 +162,6 @@ 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,
|
166
165
|
...classes.buttonMoreOption3
|
167
166
|
},
|
168
167
|
...btnProps,
|
@@ -265,7 +264,7 @@ const EditorButton = props => {
|
|
265
264
|
...btnSp,
|
266
265
|
borderStyle: borderStyle || "solid",
|
267
266
|
color: `${textColor || "#FFFFFF"}`,
|
268
|
-
fontSize: textSize || "
|
267
|
+
fontSize: textSize || "inherit",
|
269
268
|
fontFamily: fontFamily || "PoppinsRegular",
|
270
269
|
display: "inline-flex",
|
271
270
|
alignItems: "center",
|
@@ -104,9 +104,9 @@ export default function Select(props) {
|
|
104
104
|
return /*#__PURE__*/_jsx(Box, {
|
105
105
|
className: "tv-ms-tag-wrpr",
|
106
106
|
sx: {
|
107
|
-
|
108
|
-
marginRight:
|
109
|
-
|
107
|
+
"& svg": {
|
108
|
+
marginRight: "5px",
|
109
|
+
"& path": {
|
110
110
|
stroke: "#000"
|
111
111
|
}
|
112
112
|
}
|
@@ -125,15 +125,19 @@ export default function Select(props) {
|
|
125
125
|
sx: {
|
126
126
|
background: option?.color || appTheme?.palette?.editor?.tv_border1,
|
127
127
|
border: "none",
|
128
|
-
|
129
|
-
paddingLeft:
|
128
|
+
"& .MuiChip-label": {
|
129
|
+
paddingLeft: "12px !important"
|
130
130
|
}
|
131
131
|
},
|
132
132
|
avatar: /*#__PURE__*/_jsx(AvatarIcon, {
|
133
133
|
option: option,
|
134
134
|
avatar: optionAvatar
|
135
135
|
}),
|
136
|
-
deleteIcon: /*#__PURE__*/_jsx(CloseIcon, {
|
136
|
+
deleteIcon: /*#__PURE__*/_jsx(CloseIcon, {
|
137
|
+
style: {
|
138
|
+
cursor: "pointer"
|
139
|
+
}
|
140
|
+
})
|
137
141
|
}, key) : null;
|
138
142
|
})
|
139
143
|
});
|
@@ -149,8 +153,8 @@ export default function Select(props) {
|
|
149
153
|
label: option.label || option.value || "",
|
150
154
|
sx: {
|
151
155
|
background: option.color || appTheme?.palette?.editor?.tv_border1,
|
152
|
-
|
153
|
-
paddingLeft:
|
156
|
+
"& .MuiChip-label": {
|
157
|
+
paddingLeft: "12px !important"
|
154
158
|
}
|
155
159
|
},
|
156
160
|
avatar: /*#__PURE__*/_jsx(AvatarIcon, {
|
@@ -50,7 +50,8 @@ const GridItemToolbar = props => {
|
|
50
50
|
open: true,
|
51
51
|
placement: "top-end",
|
52
52
|
sx: classes.popTools,
|
53
|
-
className: "gi-tool-pp
|
53
|
+
className: "gi-tool-pp",
|
54
|
+
disablePortal: true,
|
54
55
|
contentEditable: false,
|
55
56
|
children: /*#__PURE__*/_jsxs(Box, {
|
56
57
|
className: "ico-grp-ss",
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import React, {
|
1
|
+
import React, { useState } from "react";
|
2
2
|
import { Node, Transforms } from "slate";
|
3
3
|
import { ReactEditor, useFocused, useSelected, useSlateStatic } from "slate-react";
|
4
|
-
import { Box, IconButton,
|
4
|
+
import { Box, IconButton, Tooltip } from "@mui/material";
|
5
5
|
import OpenInNewIcon from "@mui/icons-material/OpenInNew";
|
6
6
|
import EditIcon from "@mui/icons-material/Edit";
|
7
7
|
import LinkOffIcon from "@mui/icons-material/LinkOff";
|
@@ -53,7 +53,6 @@ const Link = props => {
|
|
53
53
|
const showInNewTab = element?.showInNewTab || element?.target;
|
54
54
|
const linkType = element?.linkType;
|
55
55
|
const classes = linkStyles();
|
56
|
-
const linkRef = useRef(null);
|
57
56
|
const updateLink = data => {
|
58
57
|
Transforms.setNodes(editor, data, {
|
59
58
|
at: path
|
@@ -82,53 +81,43 @@ const Link = props => {
|
|
82
81
|
const btnProps = handleLinkType(urlPath, linkType, true, showInNewTab === "_blank");
|
83
82
|
const navType = getLinkType(linkType, urlPath);
|
84
83
|
const hideOpenLink = navType === "page" || !navType;
|
85
|
-
return selected && focused ? /*#__PURE__*/
|
86
|
-
|
87
|
-
open: true,
|
88
|
-
placement: "top-start",
|
89
|
-
className: "hide-popper-on-overlap",
|
84
|
+
return selected && focused ? /*#__PURE__*/_jsxs("div", {
|
85
|
+
className: "element-toolbar hr",
|
90
86
|
contentEditable: false,
|
91
87
|
style: {
|
92
|
-
|
88
|
+
width: "150px",
|
89
|
+
top: "100%",
|
90
|
+
left: "0px",
|
91
|
+
display: "flex"
|
93
92
|
},
|
94
|
-
children: /*#__PURE__*/
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
children: /*#__PURE__*/_jsx(
|
115
|
-
|
116
|
-
|
117
|
-
})
|
118
|
-
}), /*#__PURE__*/_jsx(Tooltip, {
|
119
|
-
title: "Remove",
|
120
|
-
children: /*#__PURE__*/_jsx(IconButton, {
|
121
|
-
onClick: () => removeLink(editor),
|
122
|
-
children: /*#__PURE__*/_jsx(LinkOffIcon, {})
|
123
|
-
})
|
124
|
-
})]
|
125
|
-
})
|
93
|
+
children: [hideOpenLink ? null : /*#__PURE__*/_jsx(Tooltip, {
|
94
|
+
title: "Open",
|
95
|
+
children: /*#__PURE__*/_jsx(Box, {
|
96
|
+
sx: {
|
97
|
+
display: "inline-flex",
|
98
|
+
color: "rgba(0, 0, 0, 0.54)"
|
99
|
+
},
|
100
|
+
...btnProps,
|
101
|
+
children: /*#__PURE__*/_jsx(OpenInNewIcon, {})
|
102
|
+
})
|
103
|
+
}), /*#__PURE__*/_jsx(Tooltip, {
|
104
|
+
title: "Edit",
|
105
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
106
|
+
onClick: onEditLink,
|
107
|
+
children: /*#__PURE__*/_jsx(EditIcon, {})
|
108
|
+
})
|
109
|
+
}), /*#__PURE__*/_jsx(Tooltip, {
|
110
|
+
title: "Remove",
|
111
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
112
|
+
onClick: () => removeLink(editor),
|
113
|
+
children: /*#__PURE__*/_jsx(LinkOffIcon, {})
|
114
|
+
})
|
115
|
+
})]
|
126
116
|
}) : null;
|
127
117
|
};
|
128
118
|
const buttonProps = handleLinkType(urlPath, linkType, readOnly, showInNewTab === "_blank");
|
129
119
|
return /*#__PURE__*/_jsxs("div", {
|
130
120
|
className: "link",
|
131
|
-
ref: linkRef,
|
132
121
|
children: [/*#__PURE__*/_jsx(Box, {
|
133
122
|
...attributes,
|
134
123
|
...element.attr,
|
@@ -35,8 +35,8 @@ const SimpleTextStyle = ({
|
|
35
35
|
height: "24px",
|
36
36
|
overflow: "hidden",
|
37
37
|
fontSize: "14px",
|
38
|
-
display:
|
39
|
-
alignItems:
|
38
|
+
display: 'inline-flex',
|
39
|
+
alignItems: 'center',
|
40
40
|
"& .bg-pad-sl": {
|
41
41
|
padding: "2px 4px 2px 4px",
|
42
42
|
background: "transparent",
|
@@ -1,24 +1,12 @@
|
|
1
1
|
import React from "react";
|
2
|
-
import { Text } from "slate";
|
3
2
|
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
|
-
};
|
10
3
|
const Title = props => {
|
11
4
|
const {
|
12
|
-
element,
|
13
5
|
attributes,
|
14
|
-
children
|
15
|
-
customProps
|
6
|
+
children
|
16
7
|
} = props;
|
17
|
-
const isEmpty = !customProps?.readOnly && isEmptyTextNode(element?.children[0]) ? "empty" : "";
|
18
8
|
return /*#__PURE__*/_jsx("div", {
|
19
9
|
...attributes,
|
20
|
-
placeholder: "Title",
|
21
|
-
className: `content-editable ${isEmpty}`,
|
22
10
|
style: {
|
23
11
|
fontWeight: "bold",
|
24
12
|
fontSize: "20px"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
const VariableStyles =
|
1
|
+
const VariableStyles = () => ({
|
2
2
|
variablesItem: {
|
3
3
|
color: "#2563EB",
|
4
4
|
background: "#EEEEEE"
|
@@ -37,34 +37,8 @@ const VariableStyles = theme => ({
|
|
37
37
|
"& .MuiMenuItem-root": {
|
38
38
|
color: "#64748B"
|
39
39
|
},
|
40
|
-
"& .MuiPaper-root": {
|
41
|
-
borderRadius: '8px',
|
42
|
-
backgroundColor: `${theme?.palette?.editor?.miniToolBarBackground} !important`,
|
43
|
-
marginTop: '5px',
|
44
|
-
"@media only screen and (max-width: 599px)": {
|
45
|
-
padding: '10px 0px'
|
46
|
-
}
|
47
|
-
},
|
48
|
-
"& .MuiList-root": {
|
49
|
-
padding: '0px'
|
50
|
-
},
|
51
|
-
"& .MuiButtonBase-root": {
|
52
|
-
margin: '6px',
|
53
|
-
borderRadius: '8px',
|
54
|
-
padding: '6px 14px',
|
55
|
-
fontSize: '14px',
|
56
|
-
fontWeight: '400',
|
57
|
-
color: theme?.palette?.editor?.deletePopUpButtonTextColor,
|
58
|
-
"&:hover": {
|
59
|
-
background: `${theme?.palette?.editor?.menuOptionHoverBackground} !important`
|
60
|
-
},
|
61
|
-
"@media only screen and (max-width: 599px)": {
|
62
|
-
minHeight: '30px',
|
63
|
-
margin: '0px 6px'
|
64
|
-
}
|
65
|
-
},
|
66
40
|
"& .Mui-selected": {
|
67
|
-
backgroundColor:
|
41
|
+
backgroundColor: "rgba(0, 0, 0, 0.04) !important"
|
68
42
|
}
|
69
43
|
}
|
70
44
|
});
|
@@ -3,15 +3,11 @@ 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
|
7
|
-
import { useEditorContext } from "../../hooks/useMouseMove";
|
6
|
+
import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
|
8
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
9
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
10
9
|
const VariableButton = props => {
|
11
|
-
const
|
12
|
-
theme
|
13
|
-
} = useEditorContext();
|
14
|
-
const classes = VariableStyles(theme);
|
10
|
+
const classes = VariableStyles();
|
15
11
|
const editor = useSlateStatic();
|
16
12
|
const {
|
17
13
|
options
|
@@ -28,14 +24,13 @@ const VariableButton = props => {
|
|
28
24
|
value: "",
|
29
25
|
sx: classes.variableBtn,
|
30
26
|
onChange: updateVariable,
|
31
|
-
IconComponent: () => /*#__PURE__*/_jsx(
|
27
|
+
IconComponent: () => /*#__PURE__*/_jsx(KeyboardArrowDownIcon, {}),
|
32
28
|
MenuProps: {
|
33
29
|
sx: classes.variableMenuItem,
|
34
30
|
PaperProps: {
|
35
31
|
style: {
|
36
32
|
maxHeight: 300,
|
37
|
-
overflowY: "auto"
|
38
|
-
transformOrigin: 'top left'
|
33
|
+
overflowY: "auto"
|
39
34
|
},
|
40
35
|
sx: {
|
41
36
|
"&::-webkit-scrollbar-track": {
|
@@ -45,14 +40,6 @@ const VariableButton = props => {
|
|
45
40
|
borderRadius: "16px"
|
46
41
|
}
|
47
42
|
}
|
48
|
-
},
|
49
|
-
anchorOrigin: {
|
50
|
-
vertical: 'bottom',
|
51
|
-
horizontal: 'right'
|
52
|
-
},
|
53
|
-
transformOrigin: {
|
54
|
-
vertical: 'top',
|
55
|
-
horizontal: 'right'
|
56
43
|
}
|
57
44
|
},
|
58
45
|
children: [/*#__PURE__*/_jsx(MenuItem, {
|
@@ -416,11 +416,6 @@ 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
|
-
},
|
424
419
|
"& svg": {
|
425
420
|
width: "20px",
|
426
421
|
height: "24px"
|
@@ -1,3 +1,11 @@
|
|
1
|
-
const
|
2
|
-
|
3
|
-
|
1
|
+
export const defaultFonts = [
|
2
|
+
// "EB Garamond",
|
3
|
+
"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"];
|
4
|
+
export const otherFonts = ["PoppinsRegular", "PoppinsBold", "Monaco", "Qwitcher Grypen", "Bulgarian Garamond", "Redacted Script", "Herr Von Muellerhoff", "Dawning of a New Day", "Coming Soon", "Engagement", "Ingrid Darling", "La Belle Aurore", "Mea Culpa", "The Girl Next Door", "Helvetica", "Georgia", "Times New Roman", "Courier New", "Impact"];
|
5
|
+
export const googleFontList = ["Roboto", "Noto Sans JP", "Poppins", "Lato", "Inter", "Roboto Condensed", "Roboto Mono", "Oswald", "Noto Sans", "Nunito", "Nunito Sans", "Ubuntu", "Rubik", "Playfair Display", "Noto Sans KR", "Roboto Slab", "PT Sans", "Kanit", "Work Sans", "Lora", "DM Sans", "Mulish", "Quicksand", "Fira Sans", "Noto Sans TC", "Inconsolata", "Barlow", "Manrope", "IBM Plex Sans", "PT Serif", "Karla", "Titillium Web", "Heebo", "Noto Serif", "Nanum Gothic", "Noto Color Emoji", "Agdasima", "Bebas Neue", "Libre Franklin", "Mukta", "Outfit", "Josefin Sans", "Source Code Pro", "Jost", "Space Grotesk", "Hind Siliguri", "Arimo", "Cabin", "Barlow Condensed", "Dosis", "Fira Sans Condensed", "Bitter", "Archivo", "Figtree", "Noto Serif JP", "PT Sans Narrow", "Abel", "Noto Sans SC",
|
6
|
+
// "Source Sans 3",
|
7
|
+
"Hind",
|
8
|
+
// "Exo 2",
|
9
|
+
"Teko", "Oxygen", "Cairo", "Crimson Text", "Plus Jakarta Sans", "Overpass", "Pacifico", "Prompt", "Red Hat Display", "Varela Round", "Cormorant Garamond", "Assistant", "Comfortaa", "Lexend", "Signika Negative",
|
10
|
+
// "M PLUS Rounded 1c",
|
11
|
+
"Fjalla One", "Caveat", "IBM Plex Mono", "Arvo", "Lobster", "Schibsted Grotesk", "Chakra Petch", "Maven Pro", "Sora", "Kalam", "Onest", "Space Grotesk", "Outfit", 'Titillium Web', ...defaultFonts];
|
@@ -1,11 +1,7 @@
|
|
1
|
-
import { useEffect
|
1
|
+
import { useEffect } from "react";
|
2
2
|
import WebFont from "webfontloader";
|
3
3
|
import { useEditorContext } from "../../hooks/useMouseMove";
|
4
|
-
import { googleFontList } from "./FontList";
|
5
|
-
import CircularProgress from '@mui/material/CircularProgress';
|
6
|
-
import Box from "@mui/material/Box";
|
7
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
8
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
4
|
+
import { defaultFonts, googleFontList, otherFonts } from "./FontList";
|
9
5
|
const FontLoader = props => {
|
10
6
|
const {
|
11
7
|
otherProps,
|
@@ -14,20 +10,14 @@ const FontLoader = props => {
|
|
14
10
|
const {
|
15
11
|
setFontFamilies
|
16
12
|
} = useEditorContext();
|
17
|
-
const [loading, setLoading] = useState(false);
|
18
13
|
const loadFontsInBatches = (families, batchSize = 5, maxRetries = 3) => {
|
19
14
|
let currentIndex = 0;
|
20
15
|
let retryCount = 0;
|
21
|
-
let hideLoaderOn = 30;
|
22
16
|
function loadNextBatch() {
|
23
17
|
if (currentIndex >= families?.length) {
|
24
18
|
// console.log("All fonts have been loaded");
|
25
|
-
setLoading(false);
|
26
19
|
return;
|
27
20
|
}
|
28
|
-
if (currentIndex >= hideLoaderOn) {
|
29
|
-
setLoading(false);
|
30
|
-
}
|
31
21
|
const batch = families?.slice(currentIndex, currentIndex + batchSize);
|
32
22
|
const batchWithWeights = batch.map(font => `${font}:300,400,600,700`);
|
33
23
|
WebFont.load({
|
@@ -64,21 +54,21 @@ const FontLoader = props => {
|
|
64
54
|
loadNextBatch();
|
65
55
|
};
|
66
56
|
useEffect(() => {
|
67
|
-
let families = [...
|
57
|
+
let families = [...otherFonts, ...defaultFonts];
|
68
58
|
if (!readOnly) {
|
69
59
|
otherProps?.services("listGoogleFont", []).then(data => {
|
70
|
-
families = [...(data?.data || [])];
|
60
|
+
families = [...families, ...(data?.data || [])];
|
61
|
+
const filteredfamilies = families?.filter(font => !font?.includes("Material"));
|
71
62
|
setFontFamilies({
|
72
63
|
id: 1,
|
73
64
|
format: "fontFamily",
|
74
65
|
type: "fontfamilydropdown",
|
75
|
-
options:
|
66
|
+
options: filteredfamilies || []
|
76
67
|
});
|
77
68
|
loadFontsInBatches(families);
|
78
69
|
}).catch(err => {
|
79
70
|
// console.log(err);
|
80
71
|
});
|
81
|
-
// setLoading(true);
|
82
72
|
} else {
|
83
73
|
function correctFontArray(fontString) {
|
84
74
|
let fontsArray = fontString.split(",");
|
@@ -100,25 +90,9 @@ const FontLoader = props => {
|
|
100
90
|
families = families?.map(font => font?.replace(/\"/g, ""));
|
101
91
|
families = families?.map(font => font?.replace(", sans-serif", "")); //This is temporary fix for patch
|
102
92
|
families = families.filter(font => googleFontList.includes(font));
|
103
|
-
// setLoading(true);
|
104
93
|
loadFontsInBatches(families);
|
105
94
|
}
|
106
95
|
}, []);
|
107
|
-
return
|
108
|
-
children: loading ? /*#__PURE__*/_jsx(Box, {
|
109
|
-
sx: {
|
110
|
-
position: 'absolute',
|
111
|
-
top: 0,
|
112
|
-
left: 0,
|
113
|
-
right: 0,
|
114
|
-
bottom: 0,
|
115
|
-
zIndex: 99999,
|
116
|
-
display: 'flex',
|
117
|
-
justifyContent: 'center',
|
118
|
-
alignItems: 'center'
|
119
|
-
},
|
120
|
-
children: /*#__PURE__*/_jsx(CircularProgress, {})
|
121
|
-
}) : null
|
122
|
-
});
|
96
|
+
return null;
|
123
97
|
};
|
124
98
|
export default FontLoader;
|
@@ -9,23 +9,17 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
9
|
const SwitchViewport = props => {
|
10
10
|
const {
|
11
11
|
breakpoint,
|
12
|
-
onChange
|
13
|
-
show
|
12
|
+
onChange
|
14
13
|
} = props;
|
15
14
|
const classes = useSwitchViewport();
|
16
15
|
const {
|
17
|
-
setSelectedElement,
|
18
16
|
setActiveBreakPoint
|
19
17
|
} = useEditorContext();
|
20
18
|
useEffect(() => {
|
21
|
-
|
22
|
-
setSelectedElement({});
|
19
|
+
console.log(breakpoint);
|
23
20
|
}, [breakpoint]);
|
24
21
|
return /*#__PURE__*/_jsxs(Box, {
|
25
22
|
sx: classes.root,
|
26
|
-
style: {
|
27
|
-
display: show ? "block" : "none"
|
28
|
-
},
|
29
23
|
children: [/*#__PURE__*/_jsx(Tooltip, {
|
30
24
|
title: "Desktop View",
|
31
25
|
children: /*#__PURE__*/_jsx(IconButton, {
|
@@ -73,11 +73,6 @@ 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
|
-
},
|
81
76
|
children: /*#__PURE__*/_jsxs(Button, {
|
82
77
|
component: "label",
|
83
78
|
variant: "text",
|
@@ -1,7 +1,6 @@
|
|
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";
|
5
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
6
5
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
7
6
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
@@ -16,10 +15,7 @@ const RenderCard = ({
|
|
16
15
|
return /*#__PURE__*/_jsx(Card, {
|
17
16
|
sx: {
|
18
17
|
position: 'relative',
|
19
|
-
padding: "10px"
|
20
|
-
'& .MuiCheckbox-root svg': {
|
21
|
-
fill: 'unset !important'
|
22
|
-
}
|
18
|
+
padding: "10px"
|
23
19
|
},
|
24
20
|
children: /*#__PURE__*/_jsx(FormControlLabel, {
|
25
21
|
control: /*#__PURE__*/_jsx(Checkbox, {
|
@@ -85,9 +81,6 @@ const CardsMapping = props => {
|
|
85
81
|
selectedCard,
|
86
82
|
infoIcon
|
87
83
|
} = data;
|
88
|
-
const {
|
89
|
-
theme
|
90
|
-
} = useEditorContext();
|
91
84
|
const activeCard = value === selectedCard;
|
92
85
|
const handleChange = e => {
|
93
86
|
if (selectedCard === data?.value) {
|
@@ -106,8 +99,7 @@ const CardsMapping = props => {
|
|
106
99
|
sx: {
|
107
100
|
marginBottom: "12px",
|
108
101
|
"& .MuiPaper-root": {
|
109
|
-
|
110
|
-
border: activeCard ? "1px solid #2563EB" : `1px solid ${theme?.palette?.editor?.inputFieldBorder}`,
|
102
|
+
border: activeCard ? "1px solid #2563EB" : "1px solid #C8D8FA",
|
111
103
|
borderRadius: "8px",
|
112
104
|
boxShadow: activeCard ? "0px 4px 16px 0px #2563EB40" : "unset"
|
113
105
|
}
|
@@ -4,7 +4,6 @@ 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";
|
8
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
9
8
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
10
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
@@ -19,9 +18,6 @@ const Uploader = props => {
|
|
19
18
|
const [base64, setBase64] = useState(value?.url);
|
20
19
|
const [fileName, setFileName] = useState("");
|
21
20
|
const [uploading, setUploading] = useState(false);
|
22
|
-
const {
|
23
|
-
theme
|
24
|
-
} = useEditorContext();
|
25
21
|
const handleChange = async e => {
|
26
22
|
const uFile = e.target.files[0];
|
27
23
|
const strImage = await convertBase64(uFile);
|
@@ -103,10 +99,6 @@ const Uploader = props => {
|
|
103
99
|
className: "uploadImageSection",
|
104
100
|
children: base64 ? renderThumb() : /*#__PURE__*/_jsx(Grid, {
|
105
101
|
className: "uploadImageText",
|
106
|
-
sx: {
|
107
|
-
background: `${theme?.palette?.editor?.inputFieldBgColor}`,
|
108
|
-
border: `1px solid ${theme?.palette?.editor?.inputFieldBorder}`
|
109
|
-
},
|
110
102
|
children: /*#__PURE__*/_jsxs(Button, {
|
111
103
|
component: "label",
|
112
104
|
variant: "text",
|
@@ -1654,12 +1654,13 @@ export const CsvIcon = () => /*#__PURE__*/_jsxs("svg", {
|
|
1654
1654
|
fill: "white"
|
1655
1655
|
})]
|
1656
1656
|
});
|
1657
|
-
export const CloseIcon =
|
1657
|
+
export const CloseIcon = props => /*#__PURE__*/_jsxs("svg", {
|
1658
1658
|
width: "20",
|
1659
1659
|
height: "20",
|
1660
1660
|
viewBox: "0 0 20 20",
|
1661
1661
|
fill: "none",
|
1662
1662
|
xmlns: "http://www.w3.org/2000/svg",
|
1663
|
+
...(props || {}),
|
1663
1664
|
children: [/*#__PURE__*/_jsx("path", {
|
1664
1665
|
d: "M14.1245 5.875L5.87493 14.1246",
|
1665
1666
|
stroke: "#64748B",
|
@@ -51,17 +51,18 @@ const useCommonStyle = theme => ({
|
|
51
51
|
},
|
52
52
|
"& .MuiPaper-root": {
|
53
53
|
border: `unset !important`,
|
54
|
-
borderRadius:
|
55
|
-
height:
|
56
|
-
padding: "2px"
|
54
|
+
borderRadius: '0px',
|
55
|
+
height: 'fit-content'
|
57
56
|
},
|
58
57
|
"& p": {
|
59
58
|
marginBottom: "7px",
|
60
59
|
marginTop: "4px"
|
61
60
|
},
|
62
|
-
"&
|
63
|
-
|
64
|
-
|
61
|
+
"& .MuiPaper-root": {
|
62
|
+
border: 'unset !important',
|
63
|
+
borderRadius: '0px',
|
64
|
+
height: 'fit-content',
|
65
|
+
padding: '2px'
|
65
66
|
},
|
66
67
|
"& .muiIconsListParent": {
|
67
68
|
"& svg": {
|
@@ -75,12 +76,15 @@ const useCommonStyle = theme => ({
|
|
75
76
|
},
|
76
77
|
"&::-webkit-scrollbar-thumb": {
|
77
78
|
background: `${theme?.palette?.editor?.brainPopupScroll} !important`
|
79
|
+
},
|
80
|
+
"&::-webkit-scrollbar-track": {
|
81
|
+
visibility: "hidden"
|
78
82
|
}
|
79
83
|
},
|
80
84
|
"& .MuiGrid-root>.MuiGrid-item": {
|
81
85
|
paddingRight: "0px !important",
|
82
86
|
fontFamily: "Inter, sans-serif",
|
83
|
-
height:
|
87
|
+
height: 'fit-content'
|
84
88
|
},
|
85
89
|
"& .MuiInputBase-root": {
|
86
90
|
borderRadius: "10px",
|
@@ -141,11 +145,11 @@ const useCommonStyle = theme => ({
|
|
141
145
|
borderRadius: "10px",
|
142
146
|
width: "46px !important",
|
143
147
|
marginLeft: "10px",
|
144
|
-
height:
|
148
|
+
height: '36px !important'
|
145
149
|
}
|
146
150
|
},
|
147
|
-
|
148
|
-
margin:
|
151
|
+
'& .MuiFormHelperText-root': {
|
152
|
+
margin: '4px 0px 0px 0px',
|
149
153
|
color: theme?.palette?.editor?.closeButtonSvgStroke,
|
150
154
|
fontFamily: "Inter, sans-serif"
|
151
155
|
}
|
@@ -401,14 +405,14 @@ const useCommonStyle = theme => ({
|
|
401
405
|
padding: "8px 12px",
|
402
406
|
fontSize: "12px",
|
403
407
|
color: theme?.palette?.editor?.menuOptionTextColor,
|
404
|
-
fontWeight:
|
408
|
+
fontWeight: '500',
|
405
409
|
fontFamily: "Inter, sans-serif",
|
406
|
-
minHeight:
|
410
|
+
minHeight: '36px',
|
407
411
|
"&:hover": {
|
408
412
|
backgroundColor: theme?.palette?.editor?.menuOptionHoverBackground
|
409
413
|
}
|
410
414
|
},
|
411
|
-
|
415
|
+
'& .Mui-selected': {
|
412
416
|
background: `${theme?.palette?.editor?.menuOptionSelectedOption} !important`
|
413
417
|
},
|
414
418
|
"& .MuiListSubheader-root": {
|
@@ -417,16 +421,16 @@ const useCommonStyle = theme => ({
|
|
417
421
|
fontSize: "12px"
|
418
422
|
},
|
419
423
|
"& .MuiPaper-root": {
|
420
|
-
borderRadius:
|
421
|
-
padding:
|
424
|
+
borderRadius: '8px',
|
425
|
+
padding: '0px',
|
422
426
|
background: `${theme?.palette?.editor?.textWeightPopUpBackground} !important`
|
423
427
|
},
|
424
|
-
|
425
|
-
margin:
|
426
|
-
borderRadius:
|
428
|
+
'& .MuiButtonBase-root': {
|
429
|
+
margin: '4px',
|
430
|
+
borderRadius: '6px'
|
427
431
|
},
|
428
|
-
|
429
|
-
padding:
|
432
|
+
'& .MuiList-root': {
|
433
|
+
padding: '0px'
|
430
434
|
}
|
431
435
|
},
|
432
436
|
datePicker: {
|
@@ -471,27 +475,27 @@ const useCommonStyle = theme => ({
|
|
471
475
|
}
|
472
476
|
}
|
473
477
|
},
|
478
|
+
pageSettingPopUpRoot: {
|
479
|
+
padding: "16px 8px 16px 10px!important",
|
480
|
+
height: "100%"
|
481
|
+
},
|
474
482
|
buttonMoreOption: {
|
475
483
|
background: `${theme?.palette?.editor?.aiInputBackground} !important`,
|
476
484
|
border: `1px solid ${theme?.palette?.editor?.buttonBorder1} !important`,
|
477
|
-
padding:
|
478
|
-
|
479
|
-
width:
|
480
|
-
height:
|
481
|
-
|
485
|
+
padding: '4px !important',
|
486
|
+
'& svg': {
|
487
|
+
width: '18px !important',
|
488
|
+
height: '18px !important',
|
489
|
+
'& path': {
|
482
490
|
stroke: `${theme?.palette?.editor?.closeButtonSvgStroke} !important`
|
483
491
|
}
|
484
492
|
}
|
485
493
|
},
|
486
|
-
pageSettingPopUpRoot: {
|
487
|
-
padding: "16px 8px 16px 10px!important",
|
488
|
-
height: "100%"
|
489
|
-
},
|
490
494
|
buttonMoreOption2: {
|
491
495
|
background: `${theme?.palette?.editor?.aiInputBackground} !important`,
|
492
496
|
border: `1px solid ${theme?.palette?.editor?.buttonBorder1} !important`,
|
493
|
-
|
494
|
-
|
497
|
+
'& svg': {
|
498
|
+
'& path': {
|
495
499
|
fill: `${theme?.palette?.editor?.closeButtonSvgStroke} !important`
|
496
500
|
}
|
497
501
|
}
|
@@ -499,11 +503,11 @@ const useCommonStyle = theme => ({
|
|
499
503
|
buttonMoreOption3: {
|
500
504
|
background: `${theme?.palette?.editor?.aiInputBackground} !important`,
|
501
505
|
border: `1px solid ${theme?.palette?.editor?.buttonBorder1} !important`,
|
502
|
-
padding:
|
503
|
-
|
504
|
-
width:
|
505
|
-
height:
|
506
|
-
|
506
|
+
padding: '5px !important',
|
507
|
+
'& svg': {
|
508
|
+
width: '16px !important',
|
509
|
+
height: '16px !important',
|
510
|
+
'& path': {
|
507
511
|
stroke: `${theme?.palette?.editor?.closeButtonSvgStroke} !important`
|
508
512
|
}
|
509
513
|
}
|
@@ -511,37 +515,37 @@ const useCommonStyle = theme => ({
|
|
511
515
|
resizeButton: {
|
512
516
|
background: theme?.palette?.editor?.aiInputBackground,
|
513
517
|
border: `1px solid ${theme?.palette?.editor?.buttonBorder1}`,
|
514
|
-
padding:
|
515
|
-
borderRadius:
|
516
|
-
|
517
|
-
width:
|
518
|
-
height:
|
519
|
-
|
518
|
+
padding: '5px !important',
|
519
|
+
borderRadius: '50% !important',
|
520
|
+
'& svg': {
|
521
|
+
width: '18px',
|
522
|
+
height: '18px',
|
523
|
+
'& path': {
|
520
524
|
fill: `${theme?.palette?.editor?.closeButtonSvgStroke}`
|
521
525
|
}
|
522
526
|
},
|
523
|
-
|
527
|
+
'&:hover': {
|
524
528
|
background: theme?.palette?.editor?.aiInputBackground
|
525
529
|
}
|
526
530
|
},
|
527
531
|
gradientFillBtn: {
|
528
532
|
background: `linear-gradient(112.61deg, #2C63ED 19.3%, #8360FD 88.14%) !important`,
|
529
|
-
textTransform:
|
530
|
-
color:
|
531
|
-
padding:
|
532
|
-
height:
|
533
|
-
borderRadius:
|
534
|
-
fontWeight:
|
535
|
-
fontSize:
|
533
|
+
textTransform: 'math-auto !important',
|
534
|
+
color: '#FFFFFF !important',
|
535
|
+
padding: '0px 12px !important',
|
536
|
+
height: '32px',
|
537
|
+
borderRadius: '8px',
|
538
|
+
fontWeight: '500',
|
539
|
+
fontSize: '14px'
|
536
540
|
},
|
537
541
|
emptyThumbBtn: {
|
538
542
|
background: `${theme?.palette?.editor?.sectionSettingIconHover} !important`,
|
539
543
|
color: `${theme?.palette?.editor?.textColor} !important`,
|
540
|
-
fontSize:
|
541
|
-
|
542
|
-
width:
|
543
|
-
height:
|
544
|
-
|
544
|
+
fontSize: '14px !important',
|
545
|
+
'& svg': {
|
546
|
+
width: '20px !important',
|
547
|
+
height: '20px !important',
|
548
|
+
'& path': {
|
545
549
|
stroke: `${theme?.palette?.editor?.closeButtonSvgStroke} !important`
|
546
550
|
}
|
547
551
|
}
|
@@ -90,18 +90,9 @@ const ELEMENT_TAGS = {
|
|
90
90
|
type: "image",
|
91
91
|
url: el.getAttribute("src")
|
92
92
|
}),
|
93
|
-
LI:
|
94
|
-
|
95
|
-
|
96
|
-
return {
|
97
|
-
type: "check-list-item",
|
98
|
-
checked: checkListItem?.dataset?.checked === "true"
|
99
|
-
};
|
100
|
-
}
|
101
|
-
return {
|
102
|
-
type: "list-item"
|
103
|
-
};
|
104
|
-
},
|
93
|
+
LI: () => ({
|
94
|
+
type: "list-item"
|
95
|
+
}),
|
105
96
|
UL: () => ({
|
106
97
|
type: "unorderedList"
|
107
98
|
}),
|
@@ -118,7 +109,7 @@ const ELEMENT_TAGS = {
|
|
118
109
|
"GOOGLE-SHEETS-HTML-ORIGIN": paragraphType,
|
119
110
|
TABLE: (el, children = []) => {
|
120
111
|
try {
|
121
|
-
const bodyChild =
|
112
|
+
const bodyChild = children || [];
|
122
113
|
const firstRowChildren = bodyChild[0]?.children || [];
|
123
114
|
return {
|
124
115
|
type: "table",
|
@@ -138,11 +129,7 @@ const ELEMENT_TAGS = {
|
|
138
129
|
}),
|
139
130
|
TD: handleTableCell,
|
140
131
|
COLGROUP: paragraphType,
|
141
|
-
COL: paragraphType
|
142
|
-
HR: () => ({
|
143
|
-
type: "divider",
|
144
|
-
borderColor: "#CCC"
|
145
|
-
})
|
132
|
+
COL: paragraphType
|
146
133
|
};
|
147
134
|
|
148
135
|
// COMPAT: `B` is omitted here because Google Docs uses `<b>` in weird ways.
|
@@ -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);
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import { Transforms, Editor, Element, Node, Path } from "slate";
|
2
2
|
import deserialize from "../helper/deserialize";
|
3
3
|
import { decodeAndParseBase64 } from "../utils/helper";
|
4
|
-
import convertMDToHTML from "../helper/markdown";
|
5
4
|
const avoidDefaultInsert = ["table", "grid"];
|
6
5
|
const NON_TEXT_TAGS = ["ol", "ul", "img", "table", "video", "a", "button", "GOOGLE-SHEETS-HTML-ORIGIN"];
|
7
6
|
const ALLOWED_TEXT_NODES = ["paragraph", "title", "headingOne", "headingTwo", "headingThree"];
|
@@ -275,15 +274,9 @@ const withHtml = editor => {
|
|
275
274
|
Transforms.insertFragment(editor, formattedFragment);
|
276
275
|
return;
|
277
276
|
} else {
|
278
|
-
|
279
|
-
let parsed = new DOMParser().parseFromString(html, "text/html");
|
280
|
-
parsed = parseCopiedHTML(html);
|
281
|
-
const fragment = deserialize(parsed.body);
|
282
|
-
Transforms.insertFragment(editor, fragment);
|
283
|
-
// insertData(data);
|
277
|
+
insertData(data);
|
284
278
|
}
|
285
279
|
};
|
286
|
-
|
287
280
|
return editor;
|
288
281
|
};
|
289
282
|
export default withHtml;
|
@@ -301,30 +301,6 @@ export const getBlock = props => {
|
|
301
301
|
placeholder: "Heading 3",
|
302
302
|
children: children
|
303
303
|
});
|
304
|
-
case "headingFour":
|
305
|
-
return /*#__PURE__*/_jsx("h4", {
|
306
|
-
...attributes,
|
307
|
-
...element.attr,
|
308
|
-
className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
|
309
|
-
placeholder: "Heading 4",
|
310
|
-
children: children
|
311
|
-
});
|
312
|
-
case "headingFive":
|
313
|
-
return /*#__PURE__*/_jsx("h5", {
|
314
|
-
...attributes,
|
315
|
-
...element.attr,
|
316
|
-
className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
|
317
|
-
placeholder: "Heading 5",
|
318
|
-
children: children
|
319
|
-
});
|
320
|
-
case "headingSix":
|
321
|
-
return /*#__PURE__*/_jsx("h6", {
|
322
|
-
...attributes,
|
323
|
-
...element.attr,
|
324
|
-
className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
|
325
|
-
placeholder: "Heading 6",
|
326
|
-
children: children
|
327
|
-
});
|
328
304
|
case "blockquote":
|
329
305
|
return /*#__PURE__*/_jsx("blockquote", {
|
330
306
|
...attributes,
|
@@ -612,13 +588,6 @@ export const getBlock = props => {
|
|
612
588
|
return /*#__PURE__*/_jsx(ColumnView, {
|
613
589
|
...props
|
614
590
|
});
|
615
|
-
case "code":
|
616
|
-
return /*#__PURE__*/_jsx("code", {
|
617
|
-
...attributes,
|
618
|
-
...element.attr,
|
619
|
-
className: "markcode",
|
620
|
-
children: children
|
621
|
-
});
|
622
591
|
default:
|
623
592
|
return /*#__PURE__*/_jsx(SimpleText, {
|
624
593
|
...props,
|
@@ -82,8 +82,7 @@ const splitInlineStyleRanges = (text, inlineStyleRanges, data) => {
|
|
82
82
|
};
|
83
83
|
export const draftToSlate = props => {
|
84
84
|
const {
|
85
|
-
data
|
86
|
-
needLayout
|
85
|
+
data
|
87
86
|
} = props;
|
88
87
|
if (data?.blocks && data?.blocks?.length > 0) {
|
89
88
|
const converted = data?.blocks?.reduce((a, b) => {
|
@@ -105,7 +104,7 @@ export const draftToSlate = props => {
|
|
105
104
|
return data;
|
106
105
|
} else {
|
107
106
|
return [{
|
108
|
-
type:
|
107
|
+
type: "paragraph",
|
109
108
|
children: [{
|
110
109
|
text: ""
|
111
110
|
}]
|
@@ -625,10 +625,6 @@ export const isRestrictedNode = (event, editor) => {
|
|
625
625
|
return isNodeRestricted;
|
626
626
|
}
|
627
627
|
};
|
628
|
-
export function capitalizeFirstLetter(str) {
|
629
|
-
if (!str) return str;
|
630
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
631
|
-
}
|
632
628
|
export const insertLineBreakAtEndOfPath = (editor, path) => {
|
633
629
|
try {
|
634
630
|
const [node, nodePath] = Editor.node(editor, path); // Get the node at the specified path
|
@@ -647,13 +643,6 @@ export const insertLineBreakAtEndOfPath = (editor, path) => {
|
|
647
643
|
console.log(err);
|
648
644
|
}
|
649
645
|
};
|
650
|
-
export function isHavingSelection(editor) {
|
651
|
-
try {
|
652
|
-
return editor?.selection && !Range.isCollapsed(editor.selection);
|
653
|
-
} catch (err) {
|
654
|
-
console.log(err);
|
655
|
-
}
|
656
|
-
}
|
657
646
|
const omitNodes = ["site-settings", "page-settings"];
|
658
647
|
export function getInitialValue(value = [], readOnly) {
|
659
648
|
if (readOnly === "readonly" && value?.length) {
|
@@ -684,17 +673,20 @@ export function getInitialValue(value = [], readOnly) {
|
|
684
673
|
}
|
685
674
|
return value;
|
686
675
|
}
|
676
|
+
export function capitalizeFirstLetter(str) {
|
677
|
+
if (!str) return str;
|
678
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
679
|
+
}
|
680
|
+
export function isHavingSelection(editor) {
|
681
|
+
try {
|
682
|
+
return editor?.selection && !Range.isCollapsed(editor.selection);
|
683
|
+
} catch (err) {
|
684
|
+
console.log(err);
|
685
|
+
}
|
686
|
+
}
|
687
687
|
export function getSelectedCls(defaultCls = "", selected, selectedClsName = "selected") {
|
688
688
|
return `${defaultCls} ${selected ? selectedClsName : ""}`;
|
689
689
|
}
|
690
|
-
export function handleNegativeInteger(val) {
|
691
|
-
return val < 0 ? 0 : val;
|
692
|
-
}
|
693
|
-
export const containsSurrogatePair = text => {
|
694
|
-
// Match surrogate pairs (high and low surrogate)
|
695
|
-
const surrogatePairRegex = /[\uD800-\uDBFF][\uDC00-\uDFFF]/;
|
696
|
-
return surrogatePairRegex.test(text);
|
697
|
-
};
|
698
690
|
export const getNodeWithType = (editor, nodeType = "", otherOptions) => {
|
699
691
|
try {
|
700
692
|
const options = {
|
@@ -708,6 +700,11 @@ export const getNodeWithType = (editor, nodeType = "", otherOptions) => {
|
|
708
700
|
return [];
|
709
701
|
}
|
710
702
|
};
|
703
|
+
export const containsSurrogatePair = text => {
|
704
|
+
// Match surrogate pairs (high and low surrogate)
|
705
|
+
const surrogatePairRegex = /[\uD800-\uDBFF][\uDC00-\uDFFF]/;
|
706
|
+
return surrogatePairRegex.test(text);
|
707
|
+
};
|
711
708
|
export const getSlateDom = (editor, range) => {
|
712
709
|
try {
|
713
710
|
const slateDom = ReactEditor.toDOMRange(editor, range);
|
@@ -756,4 +753,7 @@ export const viewSlateSelection = () => {
|
|
756
753
|
export const hideSlateSelection = () => {
|
757
754
|
const root = document.documentElement;
|
758
755
|
root.style.setProperty("--slate-highlight-bg", "none");
|
759
|
-
};
|
756
|
+
};
|
757
|
+
export function handleNegativeInteger(val) {
|
758
|
+
return val < 0 ? 0 : val;
|
759
|
+
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@flozy/editor",
|
3
|
-
"version": "5.8.
|
3
|
+
"version": "5.8.8",
|
4
4
|
"description": "An Editor for flozy app brain",
|
5
5
|
"files": [
|
6
6
|
"dist"
|
@@ -30,7 +30,6 @@
|
|
30
30
|
"husky": "^8.0.3",
|
31
31
|
"interweave": "^13.1.0",
|
32
32
|
"lint-staged": "^13.2.3",
|
33
|
-
"markdown-it": "^14.1.0",
|
34
33
|
"prettier": "^3.0.1",
|
35
34
|
"react-best-gradient-color-picker": "^2.2.23",
|
36
35
|
"react-datepicker": "^4.18.0",
|
@@ -69,7 +68,7 @@
|
|
69
68
|
"storybook": "storybook dev -p 6006",
|
70
69
|
"build-storybook": "NODE_OPTIONS='--max_old_space_size=4096' storybook build",
|
71
70
|
"publish:npm": "rm -rf dist && mkdir dist && babel src/components -d dist --copy-files",
|
72
|
-
"publish:local": "rm -rf /Users/
|
71
|
+
"publish:local": "rm -rf /Users/agmac30/Documents/CODE_BASE/flozy/client/node_modules/@flozy/editor/dist && babel src/components -d /Users/agmac30/Documents/CODE_BASE/flozy/client/node_modules/@flozy/editor/dist --copy-files"
|
73
72
|
},
|
74
73
|
"eslintConfig": {
|
75
74
|
"extends": [
|
@@ -1,45 +0,0 @@
|
|
1
|
-
import MarkdownIt from "markdown-it";
|
2
|
-
const md = new MarkdownIt();
|
3
|
-
function markdownItCheckbox(md) {
|
4
|
-
md.core.ruler.push("checkbox_lists", function (state) {
|
5
|
-
const tokens = state.tokens;
|
6
|
-
for (let i = 0; i < tokens.length; i++) {
|
7
|
-
const token = tokens[i];
|
8
|
-
if (token.type === "inline" && token.content) {
|
9
|
-
const taskListRegex = /^\s*(-\s*)?\[\s*([xX\s]?)\s*\]\s+(.*)/;
|
10
|
-
const match = taskListRegex.exec(token.content);
|
11
|
-
if (match) {
|
12
|
-
token.attrJoin("class", "check-list-item");
|
13
|
-
const isChecked = match[2].toLowerCase() === "x"; // Check if checked
|
14
|
-
const content = match[3].trim(); // Extract text after checkbox
|
15
|
-
|
16
|
-
// Create new tokens for the task list item
|
17
|
-
const listItemOpenToken = new state.Token("html_inline", "", 0);
|
18
|
-
listItemOpenToken.content = `<li class="check-list-item" data-checked="${isChecked}">`;
|
19
|
-
const checkboxToken = new state.Token("html_inline", "", 0);
|
20
|
-
checkboxToken.content = `<span class='check-list-item' data-checked="${isChecked}" />`;
|
21
|
-
const textToken = new state.Token("text", "", 0);
|
22
|
-
textToken.content = content;
|
23
|
-
const listItemCloseToken = new state.Token("html_inline", "", 0);
|
24
|
-
listItemCloseToken.content = `</li>`;
|
25
|
-
|
26
|
-
// Replace the original token with the new tokens
|
27
|
-
tokens.splice(i, 1, checkboxToken, textToken);
|
28
|
-
}
|
29
|
-
}
|
30
|
-
}
|
31
|
-
});
|
32
|
-
}
|
33
|
-
|
34
|
-
// init plugin
|
35
|
-
md.use(markdownItCheckbox);
|
36
|
-
function convertMDToHTML(data) {
|
37
|
-
try {
|
38
|
-
const html = md.render(data);
|
39
|
-
return html;
|
40
|
-
} catch (err) {
|
41
|
-
console.log(err);
|
42
|
-
return data;
|
43
|
-
}
|
44
|
-
}
|
45
|
-
export default convertMDToHTML;
|