@flozy/editor 5.7.6 → 5.7.7
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 -13
- package/dist/Editor/Elements/AI/PopoverAIInput.js +12 -2
- package/dist/Editor/Elements/Button/EditorButton.js +1 -2
- package/dist/Editor/Elements/DataView/DataView.js +3 -4
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/NumberType.js +1 -5
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/TextType.js +1 -5
- package/dist/Editor/Elements/DataView/Layouts/FilterView.js +19 -23
- package/dist/Editor/Elements/Search/SearchList.js +1 -8
- 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 -20
- package/dist/Editor/Elements/Variables/VariableButton.js +3 -7
- package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +25 -24
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectAlignment.js +1 -3
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +1 -1
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectList.js +1 -3
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +1 -1
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +3 -9
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +0 -5
- package/dist/Editor/Toolbar/PopupTool/index.js +0 -2
- package/dist/Editor/common/FontLoader/FontLoader.js +5 -28
- 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/commonStyle.js +12 -13
- package/dist/Editor/helper/index.js +2 -2
- package/dist/Editor/plugins/withLayout.js +1 -1
- package/dist/Editor/utils/SlateUtilityFunctions.js +3 -2
- package/dist/Editor/utils/button.js +4 -4
- package/dist/Editor/utils/draftToSlate.js +2 -3
- package/dist/Editor/utils/helper.js +19 -60
- package/package.json +1 -1
@@ -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;
|
@@ -6,7 +6,7 @@ import AIInput from "./AIInput";
|
|
6
6
|
import { ReactEditor, useSlate } from "slate-react";
|
7
7
|
import { Node, Range, Transforms } from "slate";
|
8
8
|
import { MODES } from "./helper";
|
9
|
-
import { getSelectedText, getSlateDom
|
9
|
+
import { getSelectedText, getSlateDom } from "../../utils/helper";
|
10
10
|
import { VoiceToText } from "./VoiceToText";
|
11
11
|
import deserialize from "../../helper/deserialize";
|
12
12
|
import useEditorScroll from "../../hooks/useEditorScroll";
|
@@ -286,7 +286,17 @@ function PopoverAIInput({
|
|
286
286
|
};
|
287
287
|
useEffect(() => {
|
288
288
|
if (openAI && getSelectedText(editor).trim()) {
|
289
|
-
|
289
|
+
const customSelection = document.querySelectorAll(".slate-highlight");
|
290
|
+
const selectionBg = "rgba(35, 131, 226, 0.35)";
|
291
|
+
if (customSelection?.length) {
|
292
|
+
customSelection?.forEach(el => el.style.background = selectionBg);
|
293
|
+
|
294
|
+
// if ai is opened, remove the window selection class and open then slate selection, To resolve: focussing on the ai input removes window selection automatically
|
295
|
+
const selection = window.getSelection();
|
296
|
+
if (selection) {
|
297
|
+
selection.removeAllRanges(); // Clears the selection
|
298
|
+
}
|
299
|
+
}
|
290
300
|
}
|
291
301
|
}, [editor.selection, openAI]);
|
292
302
|
return /*#__PURE__*/_jsxs("div", {
|
@@ -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",
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import { Node, Path, Transforms } from "slate";
|
3
|
-
import { ReactEditor,
|
3
|
+
import { ReactEditor, useSlateStatic } from "slate-react";
|
4
4
|
import { Box, useTheme } from "@mui/material";
|
5
5
|
import { DataViewProvider } from "./Providers/DataViewProvider";
|
6
6
|
import useDataViewStyles from "./styles";
|
@@ -15,7 +15,7 @@ const DataView = props => {
|
|
15
15
|
theme: appTheme
|
16
16
|
} = useEditorContext();
|
17
17
|
const theme = useTheme();
|
18
|
-
const editor =
|
18
|
+
const editor = useSlateStatic();
|
19
19
|
const {
|
20
20
|
attributes,
|
21
21
|
children,
|
@@ -113,8 +113,7 @@ const DataView = props => {
|
|
113
113
|
onDuplicate: onDuplicate,
|
114
114
|
readOnly: readOnly,
|
115
115
|
title: title,
|
116
|
-
onTitleChange: onTitleChange
|
117
|
-
path: path
|
116
|
+
onTitleChange: onTitleChange
|
118
117
|
}), /*#__PURE__*/_jsx(LayoutView, {
|
119
118
|
readOnly: readOnly,
|
120
119
|
children: children
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import { TextField } from "@mui/material";
|
3
3
|
import { useDataView } from "../../Providers/DataViewProvider";
|
4
|
-
import { focusDynamicTableInput } from "../../../../utils/helper";
|
5
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
6
5
|
const NumberType = props => {
|
7
6
|
const {
|
@@ -17,7 +16,6 @@ const NumberType = props => {
|
|
17
16
|
onChange(rowIndex, {
|
18
17
|
[property]: e?.target?.value
|
19
18
|
});
|
20
|
-
focusDynamicTableInput(e);
|
21
19
|
};
|
22
20
|
return /*#__PURE__*/_jsx(TextField, {
|
23
21
|
type: "number",
|
@@ -26,9 +24,7 @@ const NumberType = props => {
|
|
26
24
|
value: value,
|
27
25
|
size: "small",
|
28
26
|
onChange: handleChange,
|
29
|
-
disabled: readOnly
|
30
|
-
id: `tv-number-input-${rowIndex}-${property}` // * should be unique
|
27
|
+
disabled: readOnly
|
31
28
|
});
|
32
29
|
};
|
33
|
-
|
34
30
|
export default NumberType;
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import { TextField } from "@mui/material";
|
3
3
|
import { useDataView } from "../../Providers/DataViewProvider";
|
4
|
-
import { focusDynamicTableInput } from "../../../../utils/helper";
|
5
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
6
5
|
const TextType = props => {
|
7
6
|
const {
|
@@ -17,7 +16,6 @@ const TextType = props => {
|
|
17
16
|
onChange(rowIndex, {
|
18
17
|
[property]: e?.target?.value
|
19
18
|
});
|
20
|
-
focusDynamicTableInput(e);
|
21
19
|
};
|
22
20
|
const formatValue = () => {
|
23
21
|
if (typeof value === "string") {
|
@@ -32,9 +30,7 @@ const TextType = props => {
|
|
32
30
|
value: formatValue(value),
|
33
31
|
size: "small",
|
34
32
|
onChange: handleChange,
|
35
|
-
disabled: readOnly
|
36
|
-
id: `tv-text-input-${rowIndex}-${property}` // * should be unique
|
33
|
+
disabled: readOnly
|
37
34
|
});
|
38
35
|
};
|
39
|
-
|
40
36
|
export default TextType;
|
@@ -5,7 +5,6 @@ import FilterSort from "./FilterSort";
|
|
5
5
|
import MoreHorizIcon from "@mui/icons-material/MoreHoriz";
|
6
6
|
import Icon from "../../../common/Icon";
|
7
7
|
import { useEditorContext } from "../../../hooks/useMouseMove";
|
8
|
-
import { focusDynamicTableInput } from "../../../utils/helper";
|
9
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
10
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
11
10
|
const FilterView = props => {
|
@@ -16,8 +15,7 @@ const FilterView = props => {
|
|
16
15
|
onEnter,
|
17
16
|
readOnly,
|
18
17
|
title,
|
19
|
-
onTitleChange
|
20
|
-
path
|
18
|
+
onTitleChange
|
21
19
|
} = props;
|
22
20
|
const {
|
23
21
|
sort,
|
@@ -72,7 +70,6 @@ const FilterView = props => {
|
|
72
70
|
};
|
73
71
|
const handleTitleChange = e => {
|
74
72
|
onTitleChange(e?.target?.value);
|
75
|
-
focusDynamicTableInput(e);
|
76
73
|
};
|
77
74
|
const handleEnter = e => {
|
78
75
|
if (e?.key === "Enter") {
|
@@ -99,25 +96,24 @@ const FilterView = props => {
|
|
99
96
|
},
|
100
97
|
value: title,
|
101
98
|
onChange: handleTitleChange,
|
102
|
-
onKeyUp: handleEnter
|
103
|
-
id: `tv-title-input-${path.join("|")}`
|
99
|
+
onKeyUp: handleEnter
|
104
100
|
}) : title || "Untitled"
|
105
101
|
}), /*#__PURE__*/_jsxs(Box, {
|
106
102
|
className: "tv-fi-wrpr",
|
107
103
|
sx: {
|
108
|
-
alignItems:
|
104
|
+
alignItems: 'center'
|
109
105
|
},
|
110
106
|
children: [/*#__PURE__*/_jsxs(Box, {
|
111
107
|
className: `tv-sb mr ${toggle ? "open" : ""}`,
|
112
108
|
sx: {
|
113
|
-
minHeight:
|
109
|
+
minHeight: '32px'
|
114
110
|
},
|
115
111
|
children: [/*#__PURE__*/_jsx(IconButton, {
|
116
112
|
type: "button",
|
117
113
|
sx: {
|
118
|
-
|
119
|
-
width:
|
120
|
-
height:
|
114
|
+
'& svg': {
|
115
|
+
width: '14px',
|
116
|
+
height: '14px'
|
121
117
|
}
|
122
118
|
},
|
123
119
|
"aria-label": "search",
|
@@ -141,12 +137,12 @@ const FilterView = props => {
|
|
141
137
|
className: ` ${sort?.length > 0 ? "active" : ""}`,
|
142
138
|
onClick: handleSortClick,
|
143
139
|
sx: {
|
144
|
-
|
140
|
+
'& svg': {
|
145
141
|
strokeWidth: 1.2
|
146
142
|
}
|
147
143
|
},
|
148
144
|
children: /*#__PURE__*/_jsx(Icon, {
|
149
|
-
icon:
|
145
|
+
icon: 'sortBy'
|
150
146
|
})
|
151
147
|
}), /*#__PURE__*/_jsx(FilterSort, {
|
152
148
|
open: open,
|
@@ -156,7 +152,7 @@ const FilterView = props => {
|
|
156
152
|
}), !readOnly ? /*#__PURE__*/_jsx(IconButton, {
|
157
153
|
className: "mr",
|
158
154
|
sx: {
|
159
|
-
|
155
|
+
'& svg': {
|
160
156
|
fill: theme?.palette?.editor?.tv_stroke
|
161
157
|
}
|
162
158
|
},
|
@@ -166,7 +162,7 @@ const FilterView = props => {
|
|
166
162
|
className: "mr",
|
167
163
|
onClick: handleDeleteRow,
|
168
164
|
children: /*#__PURE__*/_jsx(Icon, {
|
169
|
-
icon:
|
165
|
+
icon: 'trashIcon'
|
170
166
|
})
|
171
167
|
}) : null, !readOnly ? /*#__PURE__*/_jsxs(Menu, {
|
172
168
|
sx: classes.basicMenu,
|
@@ -189,24 +185,24 @@ const FilterView = props => {
|
|
189
185
|
onClick: onMenuClick("Duplicate"),
|
190
186
|
children: [" ", /*#__PURE__*/_jsx(Box, {
|
191
187
|
sx: {
|
192
|
-
marginRight:
|
193
|
-
display:
|
194
|
-
alignItems:
|
188
|
+
marginRight: '5px',
|
189
|
+
display: ' flex',
|
190
|
+
alignItems: 'center'
|
195
191
|
},
|
196
192
|
children: /*#__PURE__*/_jsx(Icon, {
|
197
|
-
icon:
|
193
|
+
icon: 'duplicateIcon'
|
198
194
|
})
|
199
195
|
}), "Duplicate"]
|
200
196
|
}), /*#__PURE__*/_jsxs(MenuItem, {
|
201
197
|
onClick: onMenuClick("Delete"),
|
202
198
|
children: [" ", /*#__PURE__*/_jsx(Box, {
|
203
199
|
sx: {
|
204
|
-
marginRight:
|
205
|
-
display:
|
206
|
-
alignItems:
|
200
|
+
marginRight: '5px',
|
201
|
+
display: ' flex',
|
202
|
+
alignItems: 'center'
|
207
203
|
},
|
208
204
|
children: /*#__PURE__*/_jsx(Icon, {
|
209
|
-
icon:
|
205
|
+
icon: 'trashIcon'
|
210
206
|
})
|
211
207
|
}), "Delete"]
|
212
208
|
})]
|
@@ -185,9 +185,6 @@ const SearchAndDocList = ({
|
|
185
185
|
gap: 1,
|
186
186
|
children: [/*#__PURE__*/_jsx(Grid, {
|
187
187
|
item: true,
|
188
|
-
sx: {
|
189
|
-
maxWidth: 'calc(100% - 45px)'
|
190
|
-
},
|
191
188
|
children: /*#__PURE__*/_jsxs(Grid, {
|
192
189
|
container: true,
|
193
190
|
alignItems: "center",
|
@@ -210,9 +207,6 @@ const SearchAndDocList = ({
|
|
210
207
|
})
|
211
208
|
}), /*#__PURE__*/_jsx(Grid, {
|
212
209
|
item: true,
|
213
|
-
sx: {
|
214
|
-
maxWidth: '100%'
|
215
|
-
},
|
216
210
|
children: /*#__PURE__*/_jsx(Typography, {
|
217
211
|
sx: {
|
218
212
|
fontSize: "12px",
|
@@ -225,8 +219,7 @@ const SearchAndDocList = ({
|
|
225
219
|
maxWidth: '230px',
|
226
220
|
textAlign: 'left',
|
227
221
|
'@media only screen and (min-width: 350px) and (max-width: 899px)': {
|
228
|
-
maxWidth: '100%'
|
229
|
-
width: '100%'
|
222
|
+
maxWidth: '100%'
|
230
223
|
}
|
231
224
|
},
|
232
225
|
children: title
|
@@ -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,26 +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
|
-
},
|
44
|
-
"& .MuiList-root": {
|
45
|
-
padding: '0px'
|
46
|
-
},
|
47
|
-
"& .MuiButtonBase-root": {
|
48
|
-
margin: '6px',
|
49
|
-
borderRadius: '8px',
|
50
|
-
padding: '6px 14px',
|
51
|
-
fontSize: '14px',
|
52
|
-
fontWeight: '400',
|
53
|
-
color: theme?.palette?.editor?.deletePopUpButtonTextColor,
|
54
|
-
"&:hover": {
|
55
|
-
background: `${theme?.palette?.editor?.menuOptionHoverBackground} !important`
|
56
|
-
}
|
57
|
-
},
|
58
40
|
"& .Mui-selected": {
|
59
|
-
backgroundColor:
|
41
|
+
backgroundColor: "rgba(0, 0, 0, 0.04) !important"
|
60
42
|
}
|
61
43
|
}
|
62
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,7 +24,7 @@ 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: {
|
@@ -4,7 +4,6 @@ import TemplateCard from "./TemplateCard";
|
|
4
4
|
import FullViewCard from "./FullViewCard";
|
5
5
|
import ButtonTemplateCard from "./ButtonTemplatesCard";
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
7
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
8
7
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
9
8
|
const CATEGORIES_SORT_INDEX = {
|
10
9
|
Brief: 1,
|
@@ -47,7 +46,7 @@ const ProgressBar = ({
|
|
47
46
|
alignItems: "center",
|
48
47
|
margin: 0,
|
49
48
|
padding: 0,
|
50
|
-
height: "
|
49
|
+
height: "50px",
|
51
50
|
overflow: "hidden"
|
52
51
|
},
|
53
52
|
children: /*#__PURE__*/_jsx(CircularProgress, {})
|
@@ -70,32 +69,34 @@ const AddTemplates = props => {
|
|
70
69
|
const [categories, setCategories] = useState([]);
|
71
70
|
const [category, setCategory] = useState("");
|
72
71
|
const [templates, setTemplates] = useState([]);
|
72
|
+
const [filteredTemplates, setFilteredTemplates] = useState([]);
|
73
73
|
useEffect(() => {
|
74
|
-
|
74
|
+
getTemplatesList();
|
75
75
|
}, []);
|
76
|
-
const
|
77
|
-
|
78
|
-
const categoryDB = await services("listCategory");
|
79
|
-
if (categoryDB?.data?.Template?.length > 0) {
|
80
|
-
setCategories(categoryDB.data.Template);
|
81
|
-
setCategory(categoryDB.data.Template[0]);
|
82
|
-
getTemplatesList(categoryDB.data.Template[0]);
|
83
|
-
}
|
84
|
-
setLoading(false);
|
76
|
+
const sortCategory = (a, b) => {
|
77
|
+
return (CATEGORIES_SORT_INDEX[a] || Infinity) - (CATEGORIES_SORT_INDEX[b] || Infinity);
|
85
78
|
};
|
86
|
-
const getTemplatesList = async
|
79
|
+
const getTemplatesList = async () => {
|
87
80
|
setLoading(true);
|
88
|
-
const result = await services("listTemplates", {
|
89
|
-
|
90
|
-
|
91
|
-
|
81
|
+
const result = await services("listTemplates", {});
|
82
|
+
const tempList = result?.data?.filter(f => f.type === "Template");
|
83
|
+
const lic = tempList?.reduce((a, b) => {
|
84
|
+
if (a.indexOf(b.category) < 0) {
|
85
|
+
a.push(b.category);
|
86
|
+
}
|
87
|
+
return a;
|
88
|
+
}, []).sort(sortCategory);
|
89
|
+
const ft = tempList?.filter(f => f.category === lic[0]);
|
90
|
+
setTemplates(tempList);
|
91
|
+
setCategories(lic);
|
92
|
+
setCategory(lic[0]);
|
93
|
+
setFilteredTemplates(ft);
|
92
94
|
setLoading(false);
|
93
95
|
};
|
94
96
|
const handleChange = (event, newValue) => {
|
95
|
-
setTemplates([]);
|
96
97
|
onSearch("");
|
97
98
|
setCategory(newValue);
|
98
|
-
|
99
|
+
setFilteredTemplates(templates.filter(f => f.category === newValue));
|
99
100
|
};
|
100
101
|
const onSelectTemplate = card => async () => {
|
101
102
|
try {
|
@@ -182,16 +183,16 @@ const AddTemplates = props => {
|
|
182
183
|
data: categories,
|
183
184
|
handleChange: handleChange
|
184
185
|
})
|
185
|
-
}), /*#__PURE__*/
|
186
|
+
}), /*#__PURE__*/_jsxs(Grid, {
|
186
187
|
container: true,
|
187
188
|
spacing: 0,
|
188
189
|
className: `${fullScreen ? "fullscreen" : ""}`,
|
189
190
|
sx: classes.templateCardsWrpr,
|
190
|
-
children:
|
191
|
+
children: [/*#__PURE__*/_jsx(ProgressBar, {
|
191
192
|
loading: loading
|
192
|
-
})
|
193
|
-
|
194
|
-
})
|
193
|
+
}), filteredTemplates.filter(filterByTitle).map(m => {
|
194
|
+
return renderTemplate(m);
|
195
|
+
})]
|
195
196
|
})]
|
196
197
|
});
|
197
198
|
};
|
@@ -51,8 +51,7 @@ const alignmentOptions = [{
|
|
51
51
|
}];
|
52
52
|
function SelectAlignment({
|
53
53
|
editor,
|
54
|
-
classes
|
55
|
-
closeMainPopup
|
54
|
+
classes
|
56
55
|
}) {
|
57
56
|
const selected = useMemo(() => {
|
58
57
|
return alignmentOptions.find(t => isBlockActive(editor, t.value));
|
@@ -60,7 +59,6 @@ function SelectAlignment({
|
|
60
59
|
const onChange = (format, option) => {
|
61
60
|
if (option.type === "block") {
|
62
61
|
toggleBlock(editor, format);
|
63
|
-
closeMainPopup();
|
64
62
|
}
|
65
63
|
};
|
66
64
|
return /*#__PURE__*/_jsx(CustomSelectTool, {
|
@@ -68,8 +68,7 @@ const listOptions = [{
|
|
68
68
|
}];
|
69
69
|
function SelectList({
|
70
70
|
editor,
|
71
|
-
classes
|
72
|
-
closeMainPopup
|
71
|
+
classes
|
73
72
|
}) {
|
74
73
|
const selectedList = useMemo(() => {
|
75
74
|
return listOptions.find(t => isBlockActive(editor, t.value));
|
@@ -80,7 +79,6 @@ function SelectList({
|
|
80
79
|
} else if (option.type === "accordion") {
|
81
80
|
insertAccordion(editor);
|
82
81
|
}
|
83
|
-
closeMainPopup();
|
84
82
|
};
|
85
83
|
return /*#__PURE__*/_jsx(CustomSelectTool, {
|
86
84
|
options: listOptions,
|
@@ -125,6 +125,7 @@ function SelectTypography({
|
|
125
125
|
...upData
|
126
126
|
}
|
127
127
|
});
|
128
|
+
closeMainPopup();
|
128
129
|
};
|
129
130
|
const selectedBlock = useMemo(() => {
|
130
131
|
return typographyOptions.find(t => {
|
@@ -166,7 +167,6 @@ function SelectTypography({
|
|
166
167
|
const [sizeInNumber] = size.split("px");
|
167
168
|
updateMarkData(Number(sizeInNumber));
|
168
169
|
}
|
169
|
-
closeMainPopup();
|
170
170
|
};
|
171
171
|
return /*#__PURE__*/_jsx(CustomSelectTool, {
|
172
172
|
options: typographyOptions,
|
@@ -14,7 +14,6 @@ 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";
|
18
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
19
18
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
20
19
|
const DEFAULT_COLOR = {
|
@@ -61,15 +60,13 @@ const MiniTextFormat = props => {
|
|
61
60
|
className: "verticalLine"
|
62
61
|
}), /*#__PURE__*/_jsx(SelectList, {
|
63
62
|
classes: classes,
|
64
|
-
editor: editor
|
65
|
-
closeMainPopup: closeMainPopup
|
63
|
+
editor: editor
|
66
64
|
}), /*#__PURE__*/_jsx("div", {
|
67
65
|
className: "verticalLine mr-1"
|
68
66
|
}), /*#__PURE__*/_jsx(SelectAlignment, {
|
69
67
|
fontAlign: fontAlign,
|
70
68
|
classes: classes,
|
71
|
-
editor: editor
|
72
|
-
closeMainPopup: closeMainPopup
|
69
|
+
editor: editor
|
73
70
|
}), /*#__PURE__*/_jsx("div", {
|
74
71
|
className: "verticalLine mr-1"
|
75
72
|
}), /*#__PURE__*/_jsx(SelectFontSize, {
|
@@ -101,10 +98,7 @@ const MiniTextFormat = props => {
|
|
101
98
|
editor: editor,
|
102
99
|
customProps: customProps
|
103
100
|
}, link.id), /*#__PURE__*/_jsx(IconButton, {
|
104
|
-
onClick: e =>
|
105
|
-
viewSlateSelection();
|
106
|
-
setAnchorEl(document.getElementById("mini-text-editor-wrapper"));
|
107
|
-
},
|
101
|
+
onClick: e => setAnchorEl(document.getElementById("mini-text-editor-wrapper")),
|
108
102
|
className: `textSettingsIcon ${open ? "btnActive" : ""}`,
|
109
103
|
children: /*#__PURE__*/_jsx(TextToolIcon, {})
|
110
104
|
}), /*#__PURE__*/_jsx(Popper, {
|
@@ -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"
|
@@ -9,7 +9,6 @@ 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";
|
13
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
14
13
|
const PopupTool = props => {
|
15
14
|
const {
|
@@ -84,7 +83,6 @@ const PopupTool = props => {
|
|
84
83
|
setAnchorEl(null);
|
85
84
|
} else {
|
86
85
|
updateAnchorEl();
|
87
|
-
hideSlateSelection(); // removes slate selection background, when there is no selection
|
88
86
|
}
|
89
87
|
}, [selection]);
|
90
88
|
useEffect(() => {
|
@@ -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
4
|
import { defaultFonts, googleFontList, otherFonts } 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";
|
9
5
|
const FontLoader = props => {
|
10
6
|
const {
|
11
7
|
otherProps,
|
@@ -14,14 +10,12 @@ 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
16
|
function loadNextBatch() {
|
22
17
|
if (currentIndex >= families?.length) {
|
23
|
-
console.log("All fonts have been loaded");
|
24
|
-
setLoading(false);
|
18
|
+
// console.log("All fonts have been loaded");
|
25
19
|
return;
|
26
20
|
}
|
27
21
|
const batch = families?.slice(currentIndex, currentIndex + batchSize);
|
@@ -33,7 +27,7 @@ const FontLoader = props => {
|
|
33
27
|
classes: false,
|
34
28
|
timeout: 2000,
|
35
29
|
active: () => {
|
36
|
-
console.log(`Fonts loaded successfully: ${batch}`);
|
30
|
+
// console.log(`Fonts loaded successfully: ${batch}`);
|
37
31
|
currentIndex += batchSize;
|
38
32
|
retryCount = 0; // Reset retry count for the next batch
|
39
33
|
loadNextBatch();
|
@@ -43,7 +37,7 @@ const FontLoader = props => {
|
|
43
37
|
|
44
38
|
if (retryCount < maxRetries) {
|
45
39
|
retryCount++;
|
46
|
-
console.log(`Retrying batch (${retryCount}/${maxRetries})...`);
|
40
|
+
// console.log(`Retrying batch (${retryCount}/${maxRetries})...`);
|
47
41
|
// Retry loading the same batch
|
48
42
|
loadNextBatch();
|
49
43
|
} else {
|
@@ -75,7 +69,6 @@ const FontLoader = props => {
|
|
75
69
|
}).catch(err => {
|
76
70
|
// console.log(err);
|
77
71
|
});
|
78
|
-
// setLoading(true);
|
79
72
|
} else {
|
80
73
|
function correctFontArray(fontString) {
|
81
74
|
let fontsArray = fontString.split(",");
|
@@ -97,25 +90,9 @@ const FontLoader = props => {
|
|
97
90
|
families = families?.map(font => font?.replace(/\"/g, ""));
|
98
91
|
families = families?.map(font => font?.replace(", sans-serif", "")); //This is temporary fix for patch
|
99
92
|
families = families.filter(font => googleFontList.includes(font));
|
100
|
-
// setLoading(true);
|
101
93
|
loadFontsInBatches(families);
|
102
94
|
}
|
103
95
|
}, []);
|
104
|
-
return
|
105
|
-
children: loading ? /*#__PURE__*/_jsx(Box, {
|
106
|
-
sx: {
|
107
|
-
position: 'absolute',
|
108
|
-
top: 0,
|
109
|
-
left: 0,
|
110
|
-
right: 0,
|
111
|
-
bottom: 0,
|
112
|
-
zIndex: 99999,
|
113
|
-
display: 'flex',
|
114
|
-
justifyContent: 'center',
|
115
|
-
alignItems: 'center'
|
116
|
-
},
|
117
|
-
children: /*#__PURE__*/_jsx(CircularProgress, {})
|
118
|
-
}) : null
|
119
|
-
});
|
96
|
+
return null;
|
120
97
|
};
|
121
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",
|
@@ -49,19 +49,15 @@ 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
|
-
padding: '2px'
|
57
|
-
},
|
58
52
|
"& p": {
|
59
53
|
marginBottom: "7px",
|
60
54
|
marginTop: "4px"
|
61
55
|
},
|
62
|
-
"&
|
63
|
-
|
64
|
-
|
56
|
+
"& .MuiPaper-root": {
|
57
|
+
border: 'unset !important',
|
58
|
+
borderRadius: '0px',
|
59
|
+
height: 'fit-content',
|
60
|
+
padding: '2px'
|
65
61
|
},
|
66
62
|
"& .muiIconsListParent": {
|
67
63
|
"& svg": {
|
@@ -75,6 +71,9 @@ const useCommonStyle = theme => ({
|
|
75
71
|
},
|
76
72
|
"&::-webkit-scrollbar-thumb": {
|
77
73
|
background: `${theme?.palette?.editor?.brainPopupScroll} !important`
|
74
|
+
},
|
75
|
+
"&::-webkit-scrollbar-track": {
|
76
|
+
visibility: "hidden"
|
78
77
|
}
|
79
78
|
},
|
80
79
|
"& .MuiGrid-root>.MuiGrid-item": {
|
@@ -471,6 +470,10 @@ const useCommonStyle = theme => ({
|
|
471
470
|
}
|
472
471
|
}
|
473
472
|
},
|
473
|
+
pageSettingPopUpRoot: {
|
474
|
+
padding: "16px 8px 16px 10px!important",
|
475
|
+
height: "100%"
|
476
|
+
},
|
474
477
|
buttonMoreOption: {
|
475
478
|
background: `${theme?.palette?.editor?.aiInputBackground} !important`,
|
476
479
|
border: `1px solid ${theme?.palette?.editor?.buttonBorder1} !important`,
|
@@ -483,10 +486,6 @@ const useCommonStyle = theme => ({
|
|
483
486
|
}
|
484
487
|
}
|
485
488
|
},
|
486
|
-
pageSettingPopUpRoot: {
|
487
|
-
padding: "16px 8px 16px 10px!important",
|
488
|
-
height: "100%"
|
489
|
-
},
|
490
489
|
buttonMoreOption2: {
|
491
490
|
background: `${theme?.palette?.editor?.aiInputBackground} !important`,
|
492
491
|
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);
|
@@ -173,9 +173,10 @@ export const getMarked = (leaf, children, theme) => {
|
|
173
173
|
if (leaf.highlight) {
|
174
174
|
children = /*#__PURE__*/_jsx("span", {
|
175
175
|
style: {
|
176
|
-
color: "inherit"
|
177
|
-
background: "var(--slate-highlight-bg)"
|
176
|
+
color: "inherit"
|
178
177
|
},
|
178
|
+
className: "slate-highlight" // while opening AI, we will use this element to highlight the selection. (PopoverAIInput.js)
|
179
|
+
,
|
179
180
|
children: children
|
180
181
|
});
|
181
182
|
}
|
@@ -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);
|
@@ -716,44 +713,6 @@ export const getSlateDom = (editor, range) => {
|
|
716
713
|
console.log(err);
|
717
714
|
}
|
718
715
|
};
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
// After typing the first word, the input loses focus.
|
723
|
-
export const focusDynamicTableInput = e => {
|
724
|
-
setTimeout(() => {
|
725
|
-
const input = document.getElementById(e.target.id);
|
726
|
-
if (input) {
|
727
|
-
// Check if the input is not already focused
|
728
|
-
if (document.activeElement !== input) {
|
729
|
-
const length = input.value.length;
|
730
|
-
// Focus on the input
|
731
|
-
input.focus();
|
732
|
-
|
733
|
-
// number input not supports selection
|
734
|
-
if (e.target.type !== "number") {
|
735
|
-
// Set the cursor to the end
|
736
|
-
input.setSelectionRange(length, length);
|
737
|
-
}
|
738
|
-
}
|
739
|
-
}
|
740
|
-
}, 0);
|
741
|
-
};
|
742
|
-
export const clearWindowSelection = () => {
|
743
|
-
const selection = window.getSelection();
|
744
|
-
if (selection) {
|
745
|
-
selection.removeAllRanges(); // Clears the selection
|
746
|
-
}
|
747
|
-
};
|
748
|
-
|
749
|
-
export const viewSlateSelection = () => {
|
750
|
-
// if ai is opened, remove the window selection class and open then slate selection, To resolve: focussing on the ai input removes window selection automatically
|
751
|
-
clearWindowSelection();
|
752
|
-
const selectionBg = "rgba(35, 131, 226, 0.35)";
|
753
|
-
const root = document.documentElement;
|
754
|
-
root.style.setProperty("--slate-highlight-bg", selectionBg);
|
755
|
-
};
|
756
|
-
export const hideSlateSelection = () => {
|
757
|
-
const root = document.documentElement;
|
758
|
-
root.style.setProperty("--slate-highlight-bg", "none");
|
759
|
-
};
|
716
|
+
export function handleNegativeInteger(val) {
|
717
|
+
return val < 0 ? 0 : val;
|
718
|
+
}
|