@flozy/editor 1.3.3 → 1.3.4
Sign up to get free protection for your applications and to get access to all the features.
@@ -26,17 +26,20 @@ const GridButton = props => {
|
|
26
26
|
});
|
27
27
|
setOpen(true);
|
28
28
|
const result = await services("listTemplates", {});
|
29
|
-
console.log(result);
|
30
29
|
setTemplates({
|
31
30
|
...templates,
|
32
31
|
list: result?.data || []
|
33
32
|
});
|
34
33
|
};
|
35
34
|
const handleInsertGrid = item => () => {
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
35
|
+
try {
|
36
|
+
let template_content = item ? JSON.parse(item.content) : null;
|
37
|
+
template_content = Array.isArray(template_content) ? template_content : [template_content];
|
38
|
+
insertGrid(editor, template_content);
|
39
|
+
handleClose();
|
40
|
+
} catch (err) {
|
41
|
+
console.log(err);
|
42
|
+
}
|
40
43
|
};
|
41
44
|
const handleClose = () => {
|
42
45
|
setOpen(false);
|
@@ -22,7 +22,8 @@ const SaveAsTemplate = props => {
|
|
22
22
|
const [template, setTemplate] = useState({
|
23
23
|
type: "Element",
|
24
24
|
category: "",
|
25
|
-
img_aws: null
|
25
|
+
img_aws: null,
|
26
|
+
title: ""
|
26
27
|
});
|
27
28
|
const [base64, setBase64] = useState(value);
|
28
29
|
const [uploading, setUploading] = useState(false);
|
@@ -74,6 +75,15 @@ const SaveAsTemplate = props => {
|
|
74
75
|
container: true,
|
75
76
|
spacing: 2,
|
76
77
|
children: [/*#__PURE__*/_jsx(Grid, {
|
78
|
+
itemx: true,
|
79
|
+
xs: 12,
|
80
|
+
children: /*#__PURE__*/_jsx(TextField, {
|
81
|
+
name: "title",
|
82
|
+
value: template?.title,
|
83
|
+
onChange: onChange,
|
84
|
+
placeholder: "Template Title"
|
85
|
+
})
|
86
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
77
87
|
item: true,
|
78
88
|
xs: 12,
|
79
89
|
children: /*#__PURE__*/_jsxs(Select, {
|