tp-react-elements-dev 1.7.2 → 1.7.4
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/components/Form/FormRender.d.ts +2 -0
- package/dist/index.esm.js +43 -15
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +43 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -52367,28 +52367,59 @@ var joditReactExports = joditReact.exports;
|
|
|
52367
52367
|
var JoditEditor = /*@__PURE__*/getDefaultExportFromCjs(joditReactExports);
|
|
52368
52368
|
|
|
52369
52369
|
const RichTextEditor = ({ props }) => {
|
|
52370
|
+
var _a;
|
|
52370
52371
|
const editor = React$1.useRef(null);
|
|
52371
52372
|
const [content, setContent] = React$1.useState("");
|
|
52372
52373
|
const value = props.getValues(props.item.name);
|
|
52373
52374
|
const config = Object.assign({ readonly: false, placeholder: "Start typing...", removeButtons: props.item.removeButtons, style: {
|
|
52374
|
-
|
|
52375
|
+
"font-family": "Arial",
|
|
52375
52376
|
}, controls: {
|
|
52376
52377
|
font: {
|
|
52377
|
-
list: {
|
|
52378
|
-
Arial: 'Arial',
|
|
52379
|
-
'Rotis Semi Sans': 'Rotis Semi Sans', // Allow Rotis Semi Sans
|
|
52380
|
-
},
|
|
52378
|
+
list: Object.assign({ Arial: "Arial" }, (_a = props.item) === null || _a === void 0 ? void 0 : _a.FontFamily),
|
|
52381
52379
|
},
|
|
52382
52380
|
fontsize: {
|
|
52383
|
-
list: joditReactExports.Jodit.atom([8, 9, 10, 11])
|
|
52384
|
-
}
|
|
52385
|
-
}, defaultFont:
|
|
52386
|
-
|
|
52387
|
-
|
|
52381
|
+
list: joditReactExports.Jodit.atom(props.item.Fonts || [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]),
|
|
52382
|
+
},
|
|
52383
|
+
}, defaultFont: "Arial", defaultFontSize: "11px", askBeforePasteFromWord: false, askBeforePasteHTML: false, hotkeys: {
|
|
52384
|
+
redo: "ctrl+z",
|
|
52385
|
+
undo: "ctrl+y,ctrl+shift+z",
|
|
52386
|
+
indent: "ctrl+]",
|
|
52387
|
+
outdent: "ctrl+[",
|
|
52388
|
+
bold: "ctrl+b",
|
|
52389
|
+
italic: "ctrl+i",
|
|
52390
|
+
removeFormat: "ctrl+shift+m",
|
|
52391
|
+
insertOrderedList: "ctrl+shift+7",
|
|
52392
|
+
insertUnorderedList: "ctrl+shift+8",
|
|
52393
|
+
openSearchDialog: "ctrl+f",
|
|
52394
|
+
openReplaceDialog: "ctrl+r",
|
|
52395
|
+
}, events: {
|
|
52396
|
+
processPaste: (event, html) => {
|
|
52397
|
+
if (editor.current && editor.current.editor) {
|
|
52398
|
+
const joditEditor = editor.current.editor;
|
|
52399
|
+
joditEditor.selection.insertHTML(html);
|
|
52400
|
+
joditEditor.tempContent = joditEditor.getHTML(); // Correct method
|
|
52401
|
+
}
|
|
52402
|
+
},
|
|
52403
|
+
afterPaste: (event) => {
|
|
52404
|
+
if (editor.current && editor.current.editor) {
|
|
52405
|
+
const joditEditor = editor.current.editor;
|
|
52406
|
+
const el = document.createElement("div");
|
|
52407
|
+
el.innerHTML = joditEditor.tempContent
|
|
52408
|
+
? joditEditor.tempContent
|
|
52409
|
+
: joditEditor.getHTML(); // Correct method
|
|
52410
|
+
joditEditor.setHTML(el.innerHTML); // Correct method
|
|
52411
|
+
joditEditor.tempContent = null;
|
|
52412
|
+
}
|
|
52413
|
+
},
|
|
52414
|
+
} }, props.item.sx);
|
|
52415
|
+
// Update content when props value changes
|
|
52416
|
+
React$1.useEffect(() => {
|
|
52417
|
+
setContent(value);
|
|
52418
|
+
}, [value]);
|
|
52388
52419
|
const handleBlur = (newContent) => {
|
|
52389
52420
|
if (newContent === "<p><br></p>") {
|
|
52390
52421
|
setContent(newContent);
|
|
52391
|
-
props.setValue(props.item.name,
|
|
52422
|
+
props.setValue(props.item.name, "");
|
|
52392
52423
|
}
|
|
52393
52424
|
else {
|
|
52394
52425
|
setContent(newContent);
|
|
@@ -52396,11 +52427,8 @@ const RichTextEditor = ({ props }) => {
|
|
|
52396
52427
|
}
|
|
52397
52428
|
props.item.onBlurFn && props.item.onBlurFn(newContent);
|
|
52398
52429
|
};
|
|
52399
|
-
React$1.useEffect(() => {
|
|
52400
|
-
setContent(value);
|
|
52401
|
-
}, [value]);
|
|
52402
52430
|
const handleChange = (newContent) => {
|
|
52403
|
-
console.log(newContent,
|
|
52431
|
+
console.log(newContent, "newContent Editor");
|
|
52404
52432
|
};
|
|
52405
52433
|
return (jsxRuntimeExports.jsx(JoditEditor, { ref: editor, value: content, config: config, tabIndex: 1, onBlur: handleBlur, onChange: handleChange }));
|
|
52406
52434
|
};
|