tp-react-elements-dev 1.7.1 → 1.7.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/index.esm.js +44 -10
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +44 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -52349,25 +52349,59 @@ var JoditEditor = /*@__PURE__*/getDefaultExportFromCjs(joditReactExports);
|
|
|
52349
52349
|
const RichTextEditor = ({ props }) => {
|
|
52350
52350
|
const editor = useRef(null);
|
|
52351
52351
|
const [content, setContent] = useState("");
|
|
52352
|
+
const value = props.getValues(props.item.name);
|
|
52352
52353
|
const config = Object.assign({ readonly: false, placeholder: "Start typing...", removeButtons: props.item.removeButtons, style: {
|
|
52353
|
-
|
|
52354
|
+
"font-family": "Arial",
|
|
52354
52355
|
}, controls: {
|
|
52355
52356
|
font: {
|
|
52356
52357
|
list: {
|
|
52357
|
-
Arial:
|
|
52358
|
-
|
|
52358
|
+
Arial: "Arial",
|
|
52359
|
+
"Rotis Semi Sans": "Rotis Semi Sans",
|
|
52359
52360
|
},
|
|
52360
52361
|
},
|
|
52361
52362
|
fontsize: {
|
|
52362
|
-
list: joditReactExports.Jodit.atom([8, 9, 10, 11])
|
|
52363
|
-
}
|
|
52364
|
-
}, defaultFont:
|
|
52365
|
-
|
|
52366
|
-
|
|
52363
|
+
list: joditReactExports.Jodit.atom([8, 9, 10, 11]),
|
|
52364
|
+
},
|
|
52365
|
+
}, defaultFont: "Arial", defaultFontSize: "11px", askBeforePasteFromWord: false, askBeforePasteHTML: false, hotkeys: {
|
|
52366
|
+
redo: "ctrl+z",
|
|
52367
|
+
undo: "ctrl+y,ctrl+shift+z",
|
|
52368
|
+
indent: "ctrl+]",
|
|
52369
|
+
outdent: "ctrl+[",
|
|
52370
|
+
bold: "ctrl+b",
|
|
52371
|
+
italic: "ctrl+i",
|
|
52372
|
+
removeFormat: "ctrl+shift+m",
|
|
52373
|
+
insertOrderedList: "ctrl+shift+7",
|
|
52374
|
+
insertUnorderedList: "ctrl+shift+8",
|
|
52375
|
+
openSearchDialog: "ctrl+f",
|
|
52376
|
+
openReplaceDialog: "ctrl+r",
|
|
52377
|
+
}, events: {
|
|
52378
|
+
processPaste: (event, html) => {
|
|
52379
|
+
if (editor.current && editor.current.editor) {
|
|
52380
|
+
const joditEditor = editor.current.editor;
|
|
52381
|
+
joditEditor.selection.insertHTML(html);
|
|
52382
|
+
joditEditor.tempContent = joditEditor.getHTML(); // Correct method
|
|
52383
|
+
}
|
|
52384
|
+
},
|
|
52385
|
+
afterPaste: (event) => {
|
|
52386
|
+
if (editor.current && editor.current.editor) {
|
|
52387
|
+
const joditEditor = editor.current.editor;
|
|
52388
|
+
const el = document.createElement("div");
|
|
52389
|
+
el.innerHTML = joditEditor.tempContent
|
|
52390
|
+
? joditEditor.tempContent
|
|
52391
|
+
: joditEditor.getHTML(); // Correct method
|
|
52392
|
+
joditEditor.setHTML(el.innerHTML); // Correct method
|
|
52393
|
+
joditEditor.tempContent = null;
|
|
52394
|
+
}
|
|
52395
|
+
},
|
|
52396
|
+
} }, props.item.sx);
|
|
52397
|
+
// Update content when props value changes
|
|
52398
|
+
useEffect(() => {
|
|
52399
|
+
setContent(value);
|
|
52400
|
+
}, [value]);
|
|
52367
52401
|
const handleBlur = (newContent) => {
|
|
52368
52402
|
if (newContent === "<p><br></p>") {
|
|
52369
52403
|
setContent(newContent);
|
|
52370
|
-
props.setValue(props.item.name,
|
|
52404
|
+
props.setValue(props.item.name, "");
|
|
52371
52405
|
}
|
|
52372
52406
|
else {
|
|
52373
52407
|
setContent(newContent);
|
|
@@ -52376,7 +52410,7 @@ const RichTextEditor = ({ props }) => {
|
|
|
52376
52410
|
props.item.onBlurFn && props.item.onBlurFn(newContent);
|
|
52377
52411
|
};
|
|
52378
52412
|
const handleChange = (newContent) => {
|
|
52379
|
-
console.log(newContent,
|
|
52413
|
+
console.log(newContent, "newContent Editor");
|
|
52380
52414
|
};
|
|
52381
52415
|
return (jsxRuntimeExports.jsx(JoditEditor, { ref: editor, value: content, config: config, tabIndex: 1, onBlur: handleBlur, onChange: handleChange }));
|
|
52382
52416
|
};
|