eleven-solutions-common-website-unique-web 9.0.29 → 9.0.30
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,11 +8,18 @@ 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 { useState } from "react";
|
|
11
|
+
import React, { useState, useRef, useMemo } from "react";
|
|
12
12
|
import { addTemplateApi } from "../api/template";
|
|
13
|
+
import JoditEditor from "jodit-react";
|
|
13
14
|
const TemplateForm = () => {
|
|
14
15
|
const [name, setName] = useState("");
|
|
15
16
|
const [content, setContent] = useState("");
|
|
17
|
+
const [placeholder, setPlaceholder] = React.useState("Default placeholder");
|
|
18
|
+
const editor = useRef(null);
|
|
19
|
+
const config = useMemo(() => ({
|
|
20
|
+
readonly: false, // Make the editor editable
|
|
21
|
+
placeholder: placeholder || "Start typing...", // Custom placeholder
|
|
22
|
+
}), [placeholder]);
|
|
16
23
|
const validateForm = () => {
|
|
17
24
|
if (!name || !content) {
|
|
18
25
|
alert("Please fill in all required fields: Name and Content.");
|
|
@@ -41,6 +48,6 @@ const TemplateForm = () => {
|
|
|
41
48
|
window.history.pushState({}, "", "/admin/template");
|
|
42
49
|
window.dispatchEvent(new PopStateEvent("popstate"));
|
|
43
50
|
};
|
|
44
|
-
return (_jsx("div", { className: "max-w-4xl p-6 mx-auto dark:bg-gray-800", children: _jsx("div", { children: _jsxs("form", { children: [_jsx("h1", { className: "text-3xl font-bold text-center text-blue-600 capitalize dark:text-white mb-4", children: "Add Template" }), _jsxs("div", { className: "mb-6 w-full", children: [_jsxs("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: ["Name ", _jsx("span", { className: "text-red-500", children: "*" })] }), _jsx("input", { required: true, type: "text", value: name, onChange: (e) => setName(e.target.value), className: "w-full px-4 py-2 mt-2 text-gray-800 bg-white border border-gray-400 rounded-md dark:bg-gray-800 dark:text-gray-300 dark:border-gray-800 focus:border-blue-400 focus:ring-blue-300 focus:ring-opacity-40 dark:focus:border-blue-300 focus:outline-none focus:ring", placeholder: "Enter Name" })] }), _jsxs("div", { className: "mb-6 w-full", children: [_jsxs("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: ["Content ", _jsx("span", { className: "text-red-500", children: "*" })] }), _jsx("input", { required: true, type: "text", value: content, onChange: (e) => setContent(e.target.value), className: "w-full px-4 py-2 mt-2 text-gray-800 bg-white border border-gray-400 rounded-md dark:bg-gray-800 dark:text-gray-300 dark:border-gray-800 focus:border-blue-400 focus:ring-blue-300 focus:ring-opacity-40 dark:focus:border-blue-300 focus:outline-none focus:ring", placeholder: "Enter Content" })] }), _jsxs("div", { className: "flex space-x-4 mt-6 justify-end", children: [_jsx("button", { type: "submit", onClick: handleAddClick, className: "px-8 py-2.5 leading-5 text-white transition-colors duration-300 transform bg-blue-600 rounded-md hover:bg-blue-500 focus:outline-none focus:bg-gray-600", children: "Add" }), _jsx("button", { type: "button", onClick: handleCancelClick, className: "px-8 py-2.5 leading-5 text-white transition-colors duration-300 transform bg-blue-600 rounded-md hover:bg-blue-500 focus:outline-none focus:bg-gray-600", children: "Cancel" })] })] }) }) }));
|
|
51
|
+
return (_jsx("div", { className: "max-w-4xl p-6 mx-auto dark:bg-gray-800", children: _jsx("div", { children: _jsxs("form", { children: [_jsx("h1", { className: "text-3xl font-bold text-center text-blue-600 capitalize dark:text-white mb-4", children: "Add Template" }), _jsxs("div", { className: "mb-6 w-full", children: [_jsxs("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: ["Name ", _jsx("span", { className: "text-red-500", children: "*" })] }), _jsx("input", { required: true, type: "text", value: name, onChange: (e) => setName(e.target.value), className: "w-full px-4 py-2 mt-2 text-gray-800 bg-white border border-gray-400 rounded-md dark:bg-gray-800 dark:text-gray-300 dark:border-gray-800 focus:border-blue-400 focus:ring-blue-300 focus:ring-opacity-40 dark:focus:border-blue-300 focus:outline-none focus:ring", placeholder: "Enter Name" })] }), _jsxs("div", { className: "mb-6 w-full", children: [_jsxs("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: ["Content ", _jsx("span", { className: "text-red-500", children: "*" })] }), _jsx("input", { required: true, type: "text", value: content, onChange: (e) => setContent(e.target.value), className: "w-full px-4 py-2 mt-2 text-gray-800 bg-white border border-gray-400 rounded-md dark:bg-gray-800 dark:text-gray-300 dark:border-gray-800 focus:border-blue-400 focus:ring-blue-300 focus:ring-opacity-40 dark:focus:border-blue-300 focus:outline-none focus:ring", placeholder: "Enter Content" })] }), _jsx(JoditEditor, { ref: editor, value: content, config: config, onBlur: (newContent) => setContent(newContent), onChange: (newContent) => { } }), _jsxs("div", { className: "flex space-x-4 mt-6 justify-end", children: [_jsx("button", { type: "submit", onClick: handleAddClick, className: "px-8 py-2.5 leading-5 text-white transition-colors duration-300 transform bg-blue-600 rounded-md hover:bg-blue-500 focus:outline-none focus:bg-gray-600", children: "Add" }), _jsx("button", { type: "button", onClick: handleCancelClick, className: "px-8 py-2.5 leading-5 text-white transition-colors duration-300 transform bg-blue-600 rounded-md hover:bg-blue-500 focus:outline-none focus:bg-gray-600", children: "Cancel" })] })] }) }) }));
|
|
45
52
|
};
|
|
46
53
|
export default TemplateForm;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eleven-solutions-common-website-unique-web",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.30",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@react-oauth/google": "^0.12.1",
|
|
24
24
|
"@tabler/icons-react": "^3.21.0",
|
|
25
|
+
"jodit-react": "^4.1.2",
|
|
25
26
|
"react-icons": "^5.3.0",
|
|
26
27
|
"react-router-dom": "^6.27.0",
|
|
27
28
|
"universal-cookie": "^7.2.2"
|
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
1
|
+
import React, { useState, useRef, useMemo } from "react";
|
|
2
2
|
import { addTemplateApi } from "../api/template";
|
|
3
|
+
import JoditEditor from "jodit-react";
|
|
3
4
|
|
|
4
5
|
const TemplateForm = () => {
|
|
5
6
|
const [name, setName] = useState("");
|
|
6
7
|
const [content, setContent] = useState("");
|
|
8
|
+
const [placeholder, setPlaceholder] = React.useState("Default placeholder");
|
|
9
|
+
|
|
10
|
+
const editor = useRef(null);
|
|
11
|
+
const config: Record<string, any> = useMemo(
|
|
12
|
+
() => ({
|
|
13
|
+
readonly: false, // Make the editor editable
|
|
14
|
+
placeholder: placeholder || "Start typing...", // Custom placeholder
|
|
15
|
+
}),
|
|
16
|
+
[placeholder]
|
|
17
|
+
);
|
|
7
18
|
|
|
8
19
|
const validateForm = () => {
|
|
9
20
|
if (!name || !content) {
|
|
@@ -69,6 +80,13 @@ const TemplateForm = () => {
|
|
|
69
80
|
placeholder="Enter Content"
|
|
70
81
|
/>
|
|
71
82
|
</div>
|
|
83
|
+
<JoditEditor
|
|
84
|
+
ref={editor}
|
|
85
|
+
value={content}
|
|
86
|
+
config={config}
|
|
87
|
+
onBlur={(newContent) => setContent(newContent)} // Update content on blur
|
|
88
|
+
onChange={(newContent) => {}}
|
|
89
|
+
/>
|
|
72
90
|
|
|
73
91
|
<div className="flex space-x-4 mt-6 justify-end">
|
|
74
92
|
<button
|