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.esm.js
CHANGED
|
@@ -52351,24 +52351,57 @@ const RichTextEditor = ({ props }) => {
|
|
|
52351
52351
|
const [content, setContent] = useState("");
|
|
52352
52352
|
const value = props.getValues(props.item.name);
|
|
52353
52353
|
const config = Object.assign({ readonly: false, placeholder: "Start typing...", removeButtons: props.item.removeButtons, style: {
|
|
52354
|
-
|
|
52354
|
+
"font-family": "Arial",
|
|
52355
52355
|
}, controls: {
|
|
52356
52356
|
font: {
|
|
52357
52357
|
list: {
|
|
52358
|
-
Arial:
|
|
52359
|
-
|
|
52358
|
+
Arial: "Arial",
|
|
52359
|
+
"Rotis Semi Sans": "Rotis Semi Sans",
|
|
52360
52360
|
},
|
|
52361
52361
|
},
|
|
52362
52362
|
fontsize: {
|
|
52363
|
-
list: joditReactExports.Jodit.atom([8, 9, 10, 11])
|
|
52364
|
-
}
|
|
52365
|
-
}, defaultFont:
|
|
52366
|
-
|
|
52367
|
-
|
|
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]);
|
|
52368
52401
|
const handleBlur = (newContent) => {
|
|
52369
52402
|
if (newContent === "<p><br></p>") {
|
|
52370
52403
|
setContent(newContent);
|
|
52371
|
-
props.setValue(props.item.name,
|
|
52404
|
+
props.setValue(props.item.name, "");
|
|
52372
52405
|
}
|
|
52373
52406
|
else {
|
|
52374
52407
|
setContent(newContent);
|
|
@@ -52376,11 +52409,8 @@ const RichTextEditor = ({ props }) => {
|
|
|
52376
52409
|
}
|
|
52377
52410
|
props.item.onBlurFn && props.item.onBlurFn(newContent);
|
|
52378
52411
|
};
|
|
52379
|
-
useEffect(() => {
|
|
52380
|
-
setContent(value);
|
|
52381
|
-
}, [value]);
|
|
52382
52412
|
const handleChange = (newContent) => {
|
|
52383
|
-
console.log(newContent,
|
|
52413
|
+
console.log(newContent, "newContent Editor");
|
|
52384
52414
|
};
|
|
52385
52415
|
return (jsxRuntimeExports.jsx(JoditEditor, { ref: editor, value: content, config: config, tabIndex: 1, onBlur: handleBlur, onChange: handleChange }));
|
|
52386
52416
|
};
|