eleven-solutions-common-website-unique-web 9.0.56 → 9.0.57

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.
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ interface EditorProps {
3
+ content: string;
4
+ setContent: (newContent: string) => void;
5
+ config?: Record<string, any>;
6
+ }
7
+ declare const Editor: React.FC<EditorProps>;
8
+ export default Editor;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useRef } from "react";
3
+ import JoditEditor from "jodit-react";
4
+ const Editor = ({ content, setContent, config }) => {
5
+ const editor = useRef(null);
6
+ return (_jsx(JoditEditor, { ref: editor, value: content, config: config, onBlur: (newContent) => setContent(newContent), onChange: () => { } }));
7
+ };
8
+ export default Editor;
@@ -11,6 +11,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
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
+ import Editor from "./Editor";
14
15
  const TemplateForm = () => {
15
16
  const [name, setName] = useState("");
16
17
  const [content, setContent] = useState("");
@@ -76,6 +77,6 @@ const TemplateForm = () => {
76
77
  window.history.pushState({}, "", "/admin/template");
77
78
  window.dispatchEvent(new PopStateEvent("popstate"));
78
79
  };
79
- 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: isEditMode ? "Edit Template" : "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(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: handleSubmit, 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: isEditMode ? "Edit" : "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" })] })] }) }) }));
80
+ 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: isEditMode ? "Edit Template" : "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(JoditEditor, { ref: editor, value: content, config: config, onBlur: (newContent) => setContent(newContent), onChange: (newContent) => { } }), _jsx(Editor, { content: content, setContent: setContent, config: config })] }), _jsxs("div", { className: "flex space-x-4 mt-6 justify-end", children: [_jsx("button", { type: "submit", onClick: handleSubmit, 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: isEditMode ? "Edit" : "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" })] })] }) }) }));
80
81
  };
81
82
  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.56",
3
+ "version": "9.0.57",
4
4
  "main": "./dist/index.js",
5
5
  "scripts": {
6
6
  "build": "tsc",
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ import { useRef } from "react";
3
+ import JoditEditor from "jodit-react";
4
+
5
+ interface EditorProps {
6
+ content: string;
7
+ setContent: (newContent: string) => void;
8
+ config?: Record<string, any>;
9
+ }
10
+
11
+ const Editor: React.FC<EditorProps> = ({ content, setContent, config }) => {
12
+ const editor = useRef(null);
13
+
14
+ return (
15
+ <JoditEditor
16
+ ref={editor}
17
+ value={content}
18
+ config={config}
19
+ onBlur={(newContent) => setContent(newContent)}
20
+ onChange={() => {}}
21
+ />
22
+ );
23
+ };
24
+
25
+ export default Editor;
@@ -6,6 +6,8 @@ import {
6
6
  } from "../api/template";
7
7
  import JoditEditor from "jodit-react";
8
8
 
9
+ import Editor from "./Editor";
10
+
9
11
  const TemplateForm = () => {
10
12
  const [name, setName] = useState("");
11
13
  const [content, setContent] = useState("");
@@ -115,6 +117,7 @@ const TemplateForm = () => {
115
117
  onBlur={(newContent) => setContent(newContent)}
116
118
  onChange={(newContent) => {}}
117
119
  />
120
+ <Editor content={content} setContent={setContent} config={config} />
118
121
  </div>
119
122
 
120
123
  <div className="flex space-x-4 mt-6 justify-end">