@flozy/editor 5.9.1 → 5.9.3
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 +22 -15
- package/dist/Editor/Editor.css +22 -16
- package/dist/Editor/Elements/AI/PopoverAIInput.js +2 -12
- package/dist/Editor/Elements/Button/EditorButton.js +3 -1
- package/dist/Editor/Elements/DataView/DataView.js +4 -3
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +8 -14
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/NumberType.js +5 -1
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/TextType.js +5 -1
- package/dist/Editor/Elements/DataView/Layouts/FilterView.js +23 -19
- package/dist/Editor/Elements/Form/Form.js +1 -0
- package/dist/Editor/Elements/FreeGrid/styles.js +1 -0
- package/dist/Editor/Elements/Grid/GridItem.js +1 -2
- package/dist/Editor/Elements/Link/Link.js +70 -43
- package/dist/Editor/Elements/List/CheckList.js +2 -1
- package/dist/Editor/Elements/Search/SearchAttachment.js +1 -0
- package/dist/Editor/Elements/Search/SearchList.js +8 -1
- package/dist/Editor/Elements/SimpleText/index.js +13 -11
- package/dist/Editor/Elements/SimpleText/style.js +5 -1
- package/dist/Editor/Elements/Table/Table.js +3 -3
- package/dist/Editor/Elements/Table/TableCell.js +14 -9
- package/dist/Editor/Elements/Title/title.js +13 -1
- package/dist/Editor/Elements/Variables/Style.js +28 -2
- package/dist/Editor/Elements/Variables/VariableButton.js +17 -4
- package/dist/Editor/MiniEditor.js +4 -2
- package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +37 -28
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectAlignment.js +3 -1
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +1 -1
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectList.js +3 -1
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +1 -1
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +9 -3
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +5 -0
- package/dist/Editor/Toolbar/PopupTool/TemplateCard.js +1 -1
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +45 -0
- package/dist/Editor/Toolbar/PopupTool/index.js +31 -37
- package/dist/Editor/common/FontLoader/FontList.js +3 -11
- package/dist/Editor/common/FontLoader/FontLoader.js +75 -43
- 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/Section/index.js +78 -97
- 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/common/iconslist.js +1 -2
- package/dist/Editor/commonStyle.js +58 -57
- package/dist/Editor/helper/ensureWrappedVariables.js +28 -0
- package/dist/Editor/helper/index.js +2 -2
- package/dist/Editor/helper/theme.js +24 -1
- package/dist/Editor/hooks/useEditorScroll.js +1 -1
- package/dist/Editor/hooks/useMouseMove.js +5 -2
- package/dist/Editor/plugins/withLayout.js +1 -1
- package/dist/Editor/utils/SlateUtilityFunctions.js +15 -4
- package/dist/Editor/utils/button.js +4 -4
- package/dist/Editor/utils/customHooks/useTableResize.js +2 -1
- package/dist/Editor/utils/draftToSlate.js +3 -2
- package/dist/Editor/utils/helper.js +60 -19
- package/dist/Editor/utils/pageSettings.js +14 -2
- package/dist/Editor/utils/table.js +21 -0
- package/package.json +2 -2
@@ -49,6 +49,7 @@ const SearchAttachment = props => {
|
|
49
49
|
background: `${theme?.palette?.containers?.slashBrainCardBg} !important`,
|
50
50
|
cursor: 'pointer',
|
51
51
|
margin: '4px 0px',
|
52
|
+
lineHeight: 1.43,
|
52
53
|
"&.MuiPaper-root.MuiPaper-rounded": {
|
53
54
|
borderRadius: "7px !important",
|
54
55
|
paddingTop: '0px !important'
|
@@ -185,6 +185,9 @@ const SearchAndDocList = ({
|
|
185
185
|
gap: 1,
|
186
186
|
children: [/*#__PURE__*/_jsx(Grid, {
|
187
187
|
item: true,
|
188
|
+
sx: {
|
189
|
+
maxWidth: 'calc(100% - 45px)'
|
190
|
+
},
|
188
191
|
children: /*#__PURE__*/_jsxs(Grid, {
|
189
192
|
container: true,
|
190
193
|
alignItems: "center",
|
@@ -207,6 +210,9 @@ const SearchAndDocList = ({
|
|
207
210
|
})
|
208
211
|
}), /*#__PURE__*/_jsx(Grid, {
|
209
212
|
item: true,
|
213
|
+
sx: {
|
214
|
+
maxWidth: '100%'
|
215
|
+
},
|
210
216
|
children: /*#__PURE__*/_jsx(Typography, {
|
211
217
|
sx: {
|
212
218
|
fontSize: "12px",
|
@@ -219,7 +225,8 @@ const SearchAndDocList = ({
|
|
219
225
|
maxWidth: '230px',
|
220
226
|
textAlign: 'left',
|
221
227
|
'@media only screen and (min-width: 350px) and (max-width: 899px)': {
|
222
|
-
maxWidth: '100%'
|
228
|
+
maxWidth: '100%',
|
229
|
+
width: '100%'
|
223
230
|
}
|
224
231
|
},
|
225
232
|
children: title
|
@@ -1,17 +1,17 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import { useSlateStatic, useSelected, ReactEditor } from "slate-react";
|
3
3
|
import { Box } from "@mui/material";
|
4
|
-
import { getPageSettings } from "../../utils/pageSettings";
|
4
|
+
// 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";
|
11
12
|
import { createElement as _createElement } from "react";
|
12
13
|
const SimpleText = props => {
|
13
14
|
const {
|
14
|
-
theme,
|
15
15
|
openAI
|
16
16
|
} = useEditorContext() || {};
|
17
17
|
const editor = useSlateStatic();
|
@@ -27,14 +27,16 @@ const SimpleText = props => {
|
|
27
27
|
readOnly,
|
28
28
|
editorPlaceholder
|
29
29
|
} = customProps;
|
30
|
+
// const { element: pageSt } = getPageSettings(editor) || {};
|
31
|
+
// const { pageColor } = pageSt?.pageProps || {};
|
30
32
|
const {
|
31
|
-
|
32
|
-
} =
|
33
|
-
const
|
34
|
-
|
35
|
-
} = pageSt?.pageProps || {};
|
33
|
+
activeBreakPoint
|
34
|
+
} = useEditorContext();
|
35
|
+
const lineHeight = element?.children[0]?.lineHeight;
|
36
|
+
const lineH = getBreakpointLineSpacing(lineHeight, activeBreakPoint);
|
36
37
|
const classes = SimpleTextStyle({
|
37
|
-
pageColor:
|
38
|
+
pageColor: "#FFFFFF",
|
39
|
+
lineHeight: lineH
|
38
40
|
});
|
39
41
|
const selected = useSelected();
|
40
42
|
const path = ReactEditor.findPath(editor, element);
|
@@ -52,14 +54,14 @@ const SimpleText = props => {
|
|
52
54
|
contentEditable: false,
|
53
55
|
className: "placeholder-simple-text",
|
54
56
|
children: isEmptyEditor ? editorPlaceholder || "Write Something..." : showPlaceHolder ? opacity && selected ? /*#__PURE__*/_jsxs(_Fragment, {
|
55
|
-
children: ["Type ", /*#__PURE__*/_jsx("span", {
|
57
|
+
children: ["Type", " ", /*#__PURE__*/_jsx("span", {
|
56
58
|
style: {
|
57
|
-
backgroundColor:
|
59
|
+
backgroundColor: "#F2F6FA",
|
58
60
|
padding: "0px 2px",
|
59
61
|
borderRadius: "2px"
|
60
62
|
},
|
61
63
|
children: "/"
|
62
|
-
}), " to browse elements"]
|
64
|
+
}), " ", "to browse elements"]
|
63
65
|
}) : "" : ""
|
64
66
|
}));
|
65
67
|
};
|
@@ -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",
|
@@ -2,7 +2,7 @@ import React, { useEffect, useRef, useState } from "react";
|
|
2
2
|
import { Editor, Transforms } from "slate";
|
3
3
|
import { ReactEditor, useSelected, useSlateStatic } from "slate-react";
|
4
4
|
import { Box, IconButton, Tooltip, Table as TableComp, TableBody, useTheme, Popper, ClickAwayListener } from "@mui/material";
|
5
|
-
import { TableUtil } from "../../utils/table";
|
5
|
+
import { TableUtil, getTableColumns, getTableRows } from "../../utils/table";
|
6
6
|
import TablePopup from "./TablePopup";
|
7
7
|
import { useEditorContext, useEditorSelection } from "../../hooks/useMouseMove";
|
8
8
|
import TableStyles from "./Styles";
|
@@ -206,7 +206,7 @@ const Table = props => {
|
|
206
206
|
}
|
207
207
|
}, theme);
|
208
208
|
const addRow = () => {
|
209
|
-
const lastRow = element
|
209
|
+
const lastRow = getTableRows(element) - 1;
|
210
210
|
const firstCol = 0;
|
211
211
|
const lastRowPath = [...path, lastRow, firstCol];
|
212
212
|
const position = Editor.start(editor, lastRowPath);
|
@@ -221,7 +221,7 @@ const Table = props => {
|
|
221
221
|
Transforms.deselect(editor);
|
222
222
|
};
|
223
223
|
const addCol = () => {
|
224
|
-
const lastCol = element
|
224
|
+
const lastCol = getTableColumns(element) - 1;
|
225
225
|
const firstRow = 0;
|
226
226
|
const lastColumnPath = [...path, firstRow, lastCol];
|
227
227
|
const position = Editor.start(editor, lastColumnPath);
|
@@ -50,6 +50,7 @@ const TableCell = props => {
|
|
50
50
|
const {
|
51
51
|
readOnly
|
52
52
|
} = customProps;
|
53
|
+
const isMobile = window.matchMedia("(max-width: 899px)")?.matches || false;
|
53
54
|
const {
|
54
55
|
bgColor,
|
55
56
|
borderColor,
|
@@ -247,20 +248,24 @@ const TableCell = props => {
|
|
247
248
|
isDragging: false
|
248
249
|
});
|
249
250
|
};
|
250
|
-
const
|
251
|
-
|
252
|
-
|
251
|
+
const eventProps = isMobile ? {
|
252
|
+
// mobile events for selection
|
253
|
+
onTouchStart: onMouseDownInCell,
|
254
|
+
onTouchMove: handleTouchMove,
|
255
|
+
onTouchEnd: handleTouchEnd
|
253
256
|
} : {
|
254
|
-
...commonTdProps,
|
255
257
|
onMouseEnter: () => onMouseEnter(path),
|
256
258
|
onMouseLeave,
|
257
259
|
onMouseDown: onMouseDownInCell,
|
258
260
|
onMouseUp,
|
259
|
-
onClick
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
261
|
+
onClick
|
262
|
+
};
|
263
|
+
const tbProps = tableResizing || resizing || over || readOnly ? {
|
264
|
+
...commonTdProps,
|
265
|
+
contentEditable: false
|
266
|
+
} : {
|
267
|
+
...commonTdProps,
|
268
|
+
...eventProps
|
264
269
|
};
|
265
270
|
const dndProps = {
|
266
271
|
id: cellId,
|
@@ -1,12 +1,24 @@
|
|
1
1
|
import React from "react";
|
2
|
+
import { Text } from "slate";
|
2
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
4
|
+
const isEmptyTextNode = node => {
|
5
|
+
if (Text.isText(node)) {
|
6
|
+
return !node.text.trim();
|
7
|
+
}
|
8
|
+
return false;
|
9
|
+
};
|
3
10
|
const Title = props => {
|
4
11
|
const {
|
12
|
+
element,
|
5
13
|
attributes,
|
6
|
-
children
|
14
|
+
children,
|
15
|
+
customProps
|
7
16
|
} = props;
|
17
|
+
const isEmpty = !customProps?.readOnly && isEmptyTextNode(element?.children[0]) ? "empty" : "";
|
8
18
|
return /*#__PURE__*/_jsx("div", {
|
9
19
|
...attributes,
|
20
|
+
placeholder: "Title",
|
21
|
+
className: `content-editable ${isEmpty}`,
|
10
22
|
style: {
|
11
23
|
fontWeight: "bold",
|
12
24
|
fontSize: "20px"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
const VariableStyles =
|
1
|
+
const VariableStyles = theme => ({
|
2
2
|
variablesItem: {
|
3
3
|
color: "#2563EB",
|
4
4
|
background: "#EEEEEE"
|
@@ -37,8 +37,34 @@ const VariableStyles = () => ({
|
|
37
37
|
"& .MuiMenuItem-root": {
|
38
38
|
color: "#64748B"
|
39
39
|
},
|
40
|
+
"& .MuiPaper-root": {
|
41
|
+
borderRadius: '8px',
|
42
|
+
backgroundColor: `${theme?.palette?.editor?.miniToolBarBackground} !important`,
|
43
|
+
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
|
+
},
|
40
66
|
"& .Mui-selected": {
|
41
|
-
backgroundColor:
|
67
|
+
backgroundColor: 'unset !important'
|
42
68
|
}
|
43
69
|
}
|
44
70
|
});
|
@@ -3,11 +3,15 @@ import { useSlateStatic } from "slate-react";
|
|
3
3
|
import { MenuItem, Select } from "@mui/material";
|
4
4
|
import { insertVariables } from "../../utils/variables";
|
5
5
|
import VariableStyles from "./Style";
|
6
|
-
import
|
6
|
+
import KeyboardArrowDownRoundedIcon from '@mui/icons-material/KeyboardArrowDownRounded';
|
7
|
+
import { useEditorContext } from "../../hooks/useMouseMove";
|
7
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
8
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
9
10
|
const VariableButton = props => {
|
10
|
-
const
|
11
|
+
const {
|
12
|
+
theme
|
13
|
+
} = useEditorContext();
|
14
|
+
const classes = VariableStyles(theme);
|
11
15
|
const editor = useSlateStatic();
|
12
16
|
const {
|
13
17
|
options
|
@@ -24,13 +28,14 @@ const VariableButton = props => {
|
|
24
28
|
value: "",
|
25
29
|
sx: classes.variableBtn,
|
26
30
|
onChange: updateVariable,
|
27
|
-
IconComponent: () => /*#__PURE__*/_jsx(
|
31
|
+
IconComponent: () => /*#__PURE__*/_jsx(KeyboardArrowDownRoundedIcon, {}),
|
28
32
|
MenuProps: {
|
29
33
|
sx: classes.variableMenuItem,
|
30
34
|
PaperProps: {
|
31
35
|
style: {
|
32
36
|
maxHeight: 300,
|
33
|
-
overflowY: "auto"
|
37
|
+
overflowY: "auto",
|
38
|
+
transformOrigin: 'top left'
|
34
39
|
},
|
35
40
|
sx: {
|
36
41
|
"&::-webkit-scrollbar-track": {
|
@@ -40,6 +45,14 @@ const VariableButton = props => {
|
|
40
45
|
borderRadius: "16px"
|
41
46
|
}
|
42
47
|
}
|
48
|
+
},
|
49
|
+
anchorOrigin: {
|
50
|
+
vertical: 'bottom',
|
51
|
+
horizontal: 'right'
|
52
|
+
},
|
53
|
+
transformOrigin: {
|
54
|
+
vertical: 'top',
|
55
|
+
horizontal: 'right'
|
43
56
|
}
|
44
57
|
},
|
45
58
|
children: [/*#__PURE__*/_jsx(MenuItem, {
|
@@ -11,6 +11,7 @@ import withCommon from "./hooks/withCommon";
|
|
11
11
|
import { serializeToText } from "./utils/serializeToText";
|
12
12
|
import "./Editor.css";
|
13
13
|
import { EditorProvider } from "./hooks/useMouseMove";
|
14
|
+
import { ensureWrappedVariables } from "./helper/ensureWrappedVariables";
|
14
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
15
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
16
17
|
const MiniEditor = props => {
|
@@ -36,7 +37,8 @@ const MiniEditor = props => {
|
|
36
37
|
needLayout: false
|
37
38
|
}));
|
38
39
|
const [isInteracted, setIsInteracted] = useState(false);
|
39
|
-
const
|
40
|
+
const updatedContent = ensureWrappedVariables(content);
|
41
|
+
const [value, setValue] = useState(ensureWrappedVariables(updatedContent));
|
40
42
|
const [deboundedValue] = useDebounce(value, 500);
|
41
43
|
const isReadOnly = readOnly === "readonly";
|
42
44
|
const customProps = {
|
@@ -149,7 +151,7 @@ const MiniEditor = props => {
|
|
149
151
|
theme: theme,
|
150
152
|
children: /*#__PURE__*/_jsxs(Slate, {
|
151
153
|
editor: editor,
|
152
|
-
initialValue:
|
154
|
+
initialValue: updatedContent,
|
153
155
|
onChange: onChange,
|
154
156
|
children: [/*#__PURE__*/_jsx(BasicToolbar, {
|
155
157
|
...props,
|
@@ -4,6 +4,7 @@ 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";
|
7
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
8
9
|
const CATEGORIES_SORT_INDEX = {
|
9
10
|
Brief: 1,
|
@@ -46,7 +47,7 @@ const ProgressBar = ({
|
|
46
47
|
alignItems: "center",
|
47
48
|
margin: 0,
|
48
49
|
padding: 0,
|
49
|
-
height: "
|
50
|
+
height: "300px",
|
50
51
|
overflow: "hidden"
|
51
52
|
},
|
52
53
|
children: /*#__PURE__*/_jsx(CircularProgress, {})
|
@@ -69,41 +70,49 @@ const AddTemplates = props => {
|
|
69
70
|
const [categories, setCategories] = useState([]);
|
70
71
|
const [category, setCategory] = useState("");
|
71
72
|
const [templates, setTemplates] = useState([]);
|
72
|
-
const [filteredTemplates, setFilteredTemplates] = useState([]);
|
73
73
|
useEffect(() => {
|
74
|
-
|
74
|
+
getCategoryList();
|
75
75
|
}, []);
|
76
|
-
const
|
77
|
-
|
76
|
+
const getCategoryList = async () => {
|
77
|
+
setLoading(true);
|
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);
|
78
85
|
};
|
79
|
-
const getTemplatesList = async
|
86
|
+
const getTemplatesList = async selectedCategory => {
|
80
87
|
setLoading(true);
|
81
|
-
const result = await services("listTemplates", {
|
82
|
-
|
83
|
-
|
84
|
-
|
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);
|
88
|
+
const result = await services("listTemplates", {
|
89
|
+
category: selectedCategory
|
90
|
+
});
|
91
|
+
setTemplates(result?.data || []);
|
94
92
|
setLoading(false);
|
95
93
|
};
|
96
94
|
const handleChange = (event, newValue) => {
|
95
|
+
setTemplates([]);
|
97
96
|
onSearch("");
|
98
97
|
setCategory(newValue);
|
99
|
-
|
98
|
+
getTemplatesList(newValue);
|
100
99
|
};
|
101
|
-
const onSelectTemplate = card => () => {
|
100
|
+
const onSelectTemplate = card => async () => {
|
102
101
|
try {
|
103
|
-
|
102
|
+
const {
|
103
|
+
data
|
104
|
+
} = await services("templateContent", {
|
105
|
+
id: card?.id
|
106
|
+
});
|
107
|
+
const content = data?.content;
|
108
|
+
if (content) {
|
109
|
+
editor.insertNode(JSON.parse(content));
|
110
|
+
} else {
|
111
|
+
console.log("No data found");
|
112
|
+
}
|
104
113
|
onClose();
|
105
114
|
} catch (err) {
|
106
|
-
console.log(err);
|
115
|
+
console.log("Error inserting template content into editor:", err);
|
107
116
|
}
|
108
117
|
};
|
109
118
|
const filterByTitle = f => {
|
@@ -173,16 +182,16 @@ const AddTemplates = props => {
|
|
173
182
|
data: categories,
|
174
183
|
handleChange: handleChange
|
175
184
|
})
|
176
|
-
}), /*#__PURE__*/
|
185
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
177
186
|
container: true,
|
178
187
|
spacing: 0,
|
179
188
|
className: `${fullScreen ? "fullscreen" : ""}`,
|
180
189
|
sx: classes.templateCardsWrpr,
|
181
|
-
children:
|
190
|
+
children: loading ? /*#__PURE__*/_jsx(ProgressBar, {
|
182
191
|
loading: loading
|
183
|
-
})
|
184
|
-
|
185
|
-
})
|
192
|
+
}) : /*#__PURE__*/_jsx(_Fragment, {
|
193
|
+
children: templates.filter(filterByTitle).map(renderTemplate)
|
194
|
+
})
|
186
195
|
})]
|
187
196
|
});
|
188
197
|
};
|
@@ -51,7 +51,8 @@ const alignmentOptions = [{
|
|
51
51
|
}];
|
52
52
|
function SelectAlignment({
|
53
53
|
editor,
|
54
|
-
classes
|
54
|
+
classes,
|
55
|
+
closeMainPopup
|
55
56
|
}) {
|
56
57
|
const selected = useMemo(() => {
|
57
58
|
return alignmentOptions.find(t => isBlockActive(editor, t.value));
|
@@ -59,6 +60,7 @@ function SelectAlignment({
|
|
59
60
|
const onChange = (format, option) => {
|
60
61
|
if (option.type === "block") {
|
61
62
|
toggleBlock(editor, format);
|
63
|
+
closeMainPopup();
|
62
64
|
}
|
63
65
|
};
|
64
66
|
return /*#__PURE__*/_jsx(CustomSelectTool, {
|
@@ -68,7 +68,8 @@ const listOptions = [{
|
|
68
68
|
}];
|
69
69
|
function SelectList({
|
70
70
|
editor,
|
71
|
-
classes
|
71
|
+
classes,
|
72
|
+
closeMainPopup
|
72
73
|
}) {
|
73
74
|
const selectedList = useMemo(() => {
|
74
75
|
return listOptions.find(t => isBlockActive(editor, t.value));
|
@@ -79,6 +80,7 @@ function SelectList({
|
|
79
80
|
} else if (option.type === "accordion") {
|
80
81
|
insertAccordion(editor);
|
81
82
|
}
|
83
|
+
closeMainPopup();
|
82
84
|
};
|
83
85
|
return /*#__PURE__*/_jsx(CustomSelectTool, {
|
84
86
|
options: listOptions,
|
@@ -125,7 +125,6 @@ function SelectTypography({
|
|
125
125
|
...upData
|
126
126
|
}
|
127
127
|
});
|
128
|
-
closeMainPopup();
|
129
128
|
};
|
130
129
|
const selectedBlock = useMemo(() => {
|
131
130
|
return typographyOptions.find(t => {
|
@@ -167,6 +166,7 @@ function SelectTypography({
|
|
167
166
|
const [sizeInNumber] = size.split("px");
|
168
167
|
updateMarkData(Number(sizeInNumber));
|
169
168
|
}
|
169
|
+
closeMainPopup();
|
170
170
|
};
|
171
171
|
return /*#__PURE__*/_jsx(CustomSelectTool, {
|
172
172
|
options: typographyOptions,
|
@@ -14,6 +14,7 @@ import MiniColorPicker from "./MiniColorPicker";
|
|
14
14
|
import SelectAlignment from "./SelectAlignment";
|
15
15
|
import SelectFontSize from "./SelectFontSize";
|
16
16
|
import InfinityAITool from "./InfinityAITool";
|
17
|
+
import { viewSlateSelection } from "../../../utils/helper";
|
17
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
18
19
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
19
20
|
const DEFAULT_COLOR = {
|
@@ -60,13 +61,15 @@ const MiniTextFormat = props => {
|
|
60
61
|
className: "verticalLine"
|
61
62
|
}), /*#__PURE__*/_jsx(SelectList, {
|
62
63
|
classes: classes,
|
63
|
-
editor: editor
|
64
|
+
editor: editor,
|
65
|
+
closeMainPopup: closeMainPopup
|
64
66
|
}), /*#__PURE__*/_jsx("div", {
|
65
67
|
className: "verticalLine mr-1"
|
66
68
|
}), /*#__PURE__*/_jsx(SelectAlignment, {
|
67
69
|
fontAlign: fontAlign,
|
68
70
|
classes: classes,
|
69
|
-
editor: editor
|
71
|
+
editor: editor,
|
72
|
+
closeMainPopup: closeMainPopup
|
70
73
|
}), /*#__PURE__*/_jsx("div", {
|
71
74
|
className: "verticalLine mr-1"
|
72
75
|
}), /*#__PURE__*/_jsx(SelectFontSize, {
|
@@ -98,7 +101,10 @@ const MiniTextFormat = props => {
|
|
98
101
|
editor: editor,
|
99
102
|
customProps: customProps
|
100
103
|
}, link.id), /*#__PURE__*/_jsx(IconButton, {
|
101
|
-
onClick: e =>
|
104
|
+
onClick: e => {
|
105
|
+
viewSlateSelection();
|
106
|
+
setAnchorEl(document.getElementById("mini-text-editor-wrapper"));
|
107
|
+
},
|
102
108
|
className: `textSettingsIcon ${open ? "btnActive" : ""}`,
|
103
109
|
children: /*#__PURE__*/_jsx(TextToolIcon, {})
|
104
110
|
}), /*#__PURE__*/_jsx(Popper, {
|
@@ -416,6 +416,11 @@ const usePopupStyle = theme => ({
|
|
416
416
|
"& .MuiOutlinedInput-notchedOutline": {
|
417
417
|
border: `1px solid ${theme?.palette?.editor?.inputFieldBorder} !important`
|
418
418
|
},
|
419
|
+
'& .MuiInputBase-root': {
|
420
|
+
'& input': {
|
421
|
+
border: "none !important"
|
422
|
+
}
|
423
|
+
},
|
419
424
|
"& svg": {
|
420
425
|
width: "20px",
|
421
426
|
height: "24px"
|
@@ -47,7 +47,7 @@ const TemplateCard = props => {
|
|
47
47
|
}), /*#__PURE__*/_jsx(CardMedia, {
|
48
48
|
className: `template-card-media ${fullScreen ? "fullscreen" : ""}`,
|
49
49
|
component: "div",
|
50
|
-
image: m?.thumbnail,
|
50
|
+
image: m?.compressedThum || m?.thumbnail,
|
51
51
|
alt: m?.title,
|
52
52
|
sx: classes.templateCardMedia
|
53
53
|
}), /*#__PURE__*/_jsx(PreviewAndSelect, {
|
@@ -14,6 +14,8 @@ import SelectSuperSubscript from "./MiniTextFormat/SelectSuperSubscript";
|
|
14
14
|
import { ColorResetIcon, TextDefaultStyleIcon } from "../../common/iconListV2";
|
15
15
|
import FontFamilyAutocomplete from "../FormatTools/FontFamilyAutocomplete";
|
16
16
|
import { useEditorContext } from "../../hooks/useMouseMove";
|
17
|
+
import LineSpacing from "../../common/StyleBuilder/fieldTypes/lineSpacing";
|
18
|
+
import { getPageSettings } from "../../utils/pageSettings";
|
17
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
18
20
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
19
21
|
const allTools = toolbarGroups.flat();
|
@@ -31,10 +33,18 @@ const TextFormat = props => {
|
|
31
33
|
const [anchorEl, setAnchorEl] = useState(null);
|
32
34
|
const [type, setType] = useState(null);
|
33
35
|
const open = Boolean(anchorEl);
|
36
|
+
const {
|
37
|
+
element: pageSt
|
38
|
+
} = getPageSettings(editor) || {};
|
39
|
+
const pageSettingLine = pageSt?.pageProps?.lineHeight;
|
34
40
|
const {
|
35
41
|
fontFamilies,
|
36
42
|
theme
|
37
43
|
} = useEditorContext();
|
44
|
+
const {
|
45
|
+
activeBreakPoint
|
46
|
+
} = useEditorContext();
|
47
|
+
const breakpoint = activeBreakPoint === "" ? "lg" : activeBreakPoint;
|
38
48
|
const fontWeight = allTools.find(f => f.format === "fontWeight");
|
39
49
|
const fontStyle = allTools.filter(f => f.type === "mark" && f.format !== "strikethrough" && f.format !== "superscript" && f.format !== "subscript");
|
40
50
|
const fontAlign = allTools.filter(f => f.format?.indexOf("align") >= 0);
|
@@ -51,6 +61,8 @@ const TextFormat = props => {
|
|
51
61
|
color: "",
|
52
62
|
bgColor: ""
|
53
63
|
};
|
64
|
+
let lineSpacingValue = activeMark(editor, 'lineHeight');
|
65
|
+
lineSpacingValue = lineSpacingValue?.[breakpoint] !== undefined ? lineSpacingValue : pageSettingLine;
|
54
66
|
const handleColorPicker = type => e => {
|
55
67
|
setType(type);
|
56
68
|
setAnchorEl(e.currentTarget);
|
@@ -91,6 +103,13 @@ const TextFormat = props => {
|
|
91
103
|
value
|
92
104
|
});
|
93
105
|
};
|
106
|
+
const handleLineSpacing = data => {
|
107
|
+
const [[format, value]] = Object.entries(data);
|
108
|
+
addMarkData(editor, {
|
109
|
+
format,
|
110
|
+
value
|
111
|
+
});
|
112
|
+
};
|
94
113
|
return /*#__PURE__*/_jsxs(Grid, {
|
95
114
|
container: true,
|
96
115
|
sx: classes.textFormatWrapper,
|
@@ -360,6 +379,32 @@ const TextFormat = props => {
|
|
360
379
|
xs: 12,
|
361
380
|
sx: classes.dividerGrid,
|
362
381
|
children: /*#__PURE__*/_jsx(Divider, {})
|
382
|
+
}), /*#__PURE__*/_jsxs(Grid, {
|
383
|
+
item: true,
|
384
|
+
xs: 12,
|
385
|
+
children: [/*#__PURE__*/_jsx(Typography, {
|
386
|
+
variant: "body1",
|
387
|
+
color: "primary",
|
388
|
+
sx: classes.typoLabel,
|
389
|
+
children: "Line Spacing"
|
390
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
391
|
+
item: true,
|
392
|
+
xs: 12,
|
393
|
+
className: "typo-icons",
|
394
|
+
sx: classes.evenSpace,
|
395
|
+
children: /*#__PURE__*/_jsx(LineSpacing, {
|
396
|
+
value: lineSpacingValue,
|
397
|
+
onChange: handleLineSpacing,
|
398
|
+
data: {
|
399
|
+
key: 'lineHeight'
|
400
|
+
}
|
401
|
+
})
|
402
|
+
})]
|
403
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
404
|
+
item: true,
|
405
|
+
xs: 12,
|
406
|
+
sx: classes.dividerGrid,
|
407
|
+
children: /*#__PURE__*/_jsx(Divider, {})
|
363
408
|
}), /*#__PURE__*/_jsx(Grid, {
|
364
409
|
item: true,
|
365
410
|
xs: 12,
|