eleven-solutions-common-website-unique-web 9.0.46 → 9.0.47
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.
|
@@ -8,13 +8,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
-
import
|
|
11
|
+
import { useState, useEffect, useRef, useMemo } from "react";
|
|
12
12
|
import { addTemplateApi, fetchTemplateByIdApi, updateTemplateApi, } from "../api/template";
|
|
13
13
|
import JoditEditor from "jodit-react";
|
|
14
14
|
const TemplateForm = () => {
|
|
15
15
|
const [name, setName] = useState("");
|
|
16
16
|
const [content, setContent] = useState("");
|
|
17
|
-
const [placeholder, setPlaceholder] = React.useState("
|
|
17
|
+
// const [placeholder, setPlaceholder] = React.useState("");
|
|
18
|
+
const placeholder = "";
|
|
18
19
|
const [isEditMode, setIsEditMode] = useState(false);
|
|
19
20
|
const editor = useRef(null);
|
|
20
21
|
const config = useMemo(() => ({
|
|
@@ -49,21 +50,6 @@ const TemplateForm = () => {
|
|
|
49
50
|
fetchTemplateData();
|
|
50
51
|
}
|
|
51
52
|
}, [id]);
|
|
52
|
-
const handleAddClick = (event) => __awaiter(void 0, void 0, void 0, function* () {
|
|
53
|
-
event.preventDefault();
|
|
54
|
-
if (!validateForm())
|
|
55
|
-
return;
|
|
56
|
-
try {
|
|
57
|
-
yield addTemplateApi(name, content);
|
|
58
|
-
alert("Template added Successfully.");
|
|
59
|
-
window.history.pushState({}, "", "/admin/template");
|
|
60
|
-
window.dispatchEvent(new PopStateEvent("popstate"));
|
|
61
|
-
}
|
|
62
|
-
catch (error) {
|
|
63
|
-
console.error("Error adding template:", error);
|
|
64
|
-
alert("Failed to add template.");
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
53
|
const handleSubmit = (event) => __awaiter(void 0, void 0, void 0, function* () {
|
|
68
54
|
event.preventDefault();
|
|
69
55
|
if (!validateForm())
|
package/package.json
CHANGED
|
@@ -9,7 +9,8 @@ import JoditEditor from "jodit-react";
|
|
|
9
9
|
const TemplateForm = () => {
|
|
10
10
|
const [name, setName] = useState("");
|
|
11
11
|
const [content, setContent] = useState("");
|
|
12
|
-
const [placeholder, setPlaceholder] = React.useState("
|
|
12
|
+
// const [placeholder, setPlaceholder] = React.useState("");
|
|
13
|
+
const placeholder = "";
|
|
13
14
|
|
|
14
15
|
const [isEditMode, setIsEditMode] = useState<boolean>(false);
|
|
15
16
|
|
|
@@ -55,20 +56,6 @@ const TemplateForm = () => {
|
|
|
55
56
|
}
|
|
56
57
|
}, [id]);
|
|
57
58
|
|
|
58
|
-
const handleAddClick = async (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
59
|
-
event.preventDefault();
|
|
60
|
-
if (!validateForm()) return;
|
|
61
|
-
try {
|
|
62
|
-
await addTemplateApi(name, content);
|
|
63
|
-
alert("Template added Successfully.");
|
|
64
|
-
window.history.pushState({}, "", "/admin/template");
|
|
65
|
-
window.dispatchEvent(new PopStateEvent("popstate"));
|
|
66
|
-
} catch (error) {
|
|
67
|
-
console.error("Error adding template:", error);
|
|
68
|
-
alert("Failed to add template.");
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
|
|
72
59
|
const handleSubmit = async (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
73
60
|
event.preventDefault();
|
|
74
61
|
if (!validateForm()) return;
|