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