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.js
CHANGED
|
@@ -52369,25 +52369,59 @@ var JoditEditor = /*@__PURE__*/getDefaultExportFromCjs(joditReactExports);
|
|
|
52369
52369
|
const RichTextEditor = ({ props }) => {
|
|
52370
52370
|
const editor = React$1.useRef(null);
|
|
52371
52371
|
const [content, setContent] = React$1.useState("");
|
|
52372
|
+
const value = props.getValues(props.item.name);
|
|
52372
52373
|
const config = Object.assign({ readonly: false, placeholder: "Start typing...", removeButtons: props.item.removeButtons, style: {
|
|
52373
|
-
|
|
52374
|
+
"font-family": "Arial",
|
|
52374
52375
|
}, controls: {
|
|
52375
52376
|
font: {
|
|
52376
52377
|
list: {
|
|
52377
|
-
Arial:
|
|
52378
|
-
|
|
52378
|
+
Arial: "Arial",
|
|
52379
|
+
"Rotis Semi Sans": "Rotis Semi Sans",
|
|
52379
52380
|
},
|
|
52380
52381
|
},
|
|
52381
52382
|
fontsize: {
|
|
52382
|
-
list: joditReactExports.Jodit.atom([8, 9, 10, 11])
|
|
52383
|
-
}
|
|
52384
|
-
}, defaultFont:
|
|
52385
|
-
|
|
52386
|
-
|
|
52383
|
+
list: joditReactExports.Jodit.atom([8, 9, 10, 11]),
|
|
52384
|
+
},
|
|
52385
|
+
}, defaultFont: "Arial", defaultFontSize: "11px", askBeforePasteFromWord: false, askBeforePasteHTML: false, hotkeys: {
|
|
52386
|
+
redo: "ctrl+z",
|
|
52387
|
+
undo: "ctrl+y,ctrl+shift+z",
|
|
52388
|
+
indent: "ctrl+]",
|
|
52389
|
+
outdent: "ctrl+[",
|
|
52390
|
+
bold: "ctrl+b",
|
|
52391
|
+
italic: "ctrl+i",
|
|
52392
|
+
removeFormat: "ctrl+shift+m",
|
|
52393
|
+
insertOrderedList: "ctrl+shift+7",
|
|
52394
|
+
insertUnorderedList: "ctrl+shift+8",
|
|
52395
|
+
openSearchDialog: "ctrl+f",
|
|
52396
|
+
openReplaceDialog: "ctrl+r",
|
|
52397
|
+
}, events: {
|
|
52398
|
+
processPaste: (event, html) => {
|
|
52399
|
+
if (editor.current && editor.current.editor) {
|
|
52400
|
+
const joditEditor = editor.current.editor;
|
|
52401
|
+
joditEditor.selection.insertHTML(html);
|
|
52402
|
+
joditEditor.tempContent = joditEditor.getHTML(); // Correct method
|
|
52403
|
+
}
|
|
52404
|
+
},
|
|
52405
|
+
afterPaste: (event) => {
|
|
52406
|
+
if (editor.current && editor.current.editor) {
|
|
52407
|
+
const joditEditor = editor.current.editor;
|
|
52408
|
+
const el = document.createElement("div");
|
|
52409
|
+
el.innerHTML = joditEditor.tempContent
|
|
52410
|
+
? joditEditor.tempContent
|
|
52411
|
+
: joditEditor.getHTML(); // Correct method
|
|
52412
|
+
joditEditor.setHTML(el.innerHTML); // Correct method
|
|
52413
|
+
joditEditor.tempContent = null;
|
|
52414
|
+
}
|
|
52415
|
+
},
|
|
52416
|
+
} }, props.item.sx);
|
|
52417
|
+
// Update content when props value changes
|
|
52418
|
+
React$1.useEffect(() => {
|
|
52419
|
+
setContent(value);
|
|
52420
|
+
}, [value]);
|
|
52387
52421
|
const handleBlur = (newContent) => {
|
|
52388
52422
|
if (newContent === "<p><br></p>") {
|
|
52389
52423
|
setContent(newContent);
|
|
52390
|
-
props.setValue(props.item.name,
|
|
52424
|
+
props.setValue(props.item.name, "");
|
|
52391
52425
|
}
|
|
52392
52426
|
else {
|
|
52393
52427
|
setContent(newContent);
|
|
@@ -52396,7 +52430,7 @@ const RichTextEditor = ({ props }) => {
|
|
|
52396
52430
|
props.item.onBlurFn && props.item.onBlurFn(newContent);
|
|
52397
52431
|
};
|
|
52398
52432
|
const handleChange = (newContent) => {
|
|
52399
|
-
console.log(newContent,
|
|
52433
|
+
console.log(newContent, "newContent Editor");
|
|
52400
52434
|
};
|
|
52401
52435
|
return (jsxRuntimeExports.jsx(JoditEditor, { ref: editor, value: content, config: config, tabIndex: 1, onBlur: handleBlur, onChange: handleChange }));
|
|
52402
52436
|
};
|