tp-react-elements-dev 1.7.2 → 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 +43 -13
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +43 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -52371,24 +52371,57 @@ const RichTextEditor = ({ props }) => {
|
|
|
52371
52371
|
const [content, setContent] = React$1.useState("");
|
|
52372
52372
|
const value = props.getValues(props.item.name);
|
|
52373
52373
|
const config = Object.assign({ readonly: false, placeholder: "Start typing...", removeButtons: props.item.removeButtons, style: {
|
|
52374
|
-
|
|
52374
|
+
"font-family": "Arial",
|
|
52375
52375
|
}, controls: {
|
|
52376
52376
|
font: {
|
|
52377
52377
|
list: {
|
|
52378
|
-
Arial:
|
|
52379
|
-
|
|
52378
|
+
Arial: "Arial",
|
|
52379
|
+
"Rotis Semi Sans": "Rotis Semi Sans",
|
|
52380
52380
|
},
|
|
52381
52381
|
},
|
|
52382
52382
|
fontsize: {
|
|
52383
|
-
list: joditReactExports.Jodit.atom([8, 9, 10, 11])
|
|
52384
|
-
}
|
|
52385
|
-
}, defaultFont:
|
|
52386
|
-
|
|
52387
|
-
|
|
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]);
|
|
52388
52421
|
const handleBlur = (newContent) => {
|
|
52389
52422
|
if (newContent === "<p><br></p>") {
|
|
52390
52423
|
setContent(newContent);
|
|
52391
|
-
props.setValue(props.item.name,
|
|
52424
|
+
props.setValue(props.item.name, "");
|
|
52392
52425
|
}
|
|
52393
52426
|
else {
|
|
52394
52427
|
setContent(newContent);
|
|
@@ -52396,11 +52429,8 @@ const RichTextEditor = ({ props }) => {
|
|
|
52396
52429
|
}
|
|
52397
52430
|
props.item.onBlurFn && props.item.onBlurFn(newContent);
|
|
52398
52431
|
};
|
|
52399
|
-
React$1.useEffect(() => {
|
|
52400
|
-
setContent(value);
|
|
52401
|
-
}, [value]);
|
|
52402
52432
|
const handleChange = (newContent) => {
|
|
52403
|
-
console.log(newContent,
|
|
52433
|
+
console.log(newContent, "newContent Editor");
|
|
52404
52434
|
};
|
|
52405
52435
|
return (jsxRuntimeExports.jsx(JoditEditor, { ref: editor, value: content, config: config, tabIndex: 1, onBlur: handleBlur, onChange: handleChange }));
|
|
52406
52436
|
};
|