@centreon/ui 23.10.59 → 23.10.61
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/package.json
CHANGED
|
@@ -53,6 +53,7 @@ interface Props {
|
|
|
53
53
|
error?: string;
|
|
54
54
|
hasInitialTextContent?: boolean;
|
|
55
55
|
initialEditorState?: string;
|
|
56
|
+
initialize?: (editor) => void;
|
|
56
57
|
inputClassname?: string;
|
|
57
58
|
minInputHeight: number;
|
|
58
59
|
namespace: string;
|
|
@@ -77,7 +78,8 @@ const ContentEditable = ({
|
|
|
77
78
|
error,
|
|
78
79
|
onBlur,
|
|
79
80
|
className,
|
|
80
|
-
disabled
|
|
81
|
+
disabled,
|
|
82
|
+
initialize
|
|
81
83
|
}: Props): JSX.Element => {
|
|
82
84
|
const { classes, cx } = useStyles({ editable, error, minInputHeight });
|
|
83
85
|
const { t } = useTranslation();
|
|
@@ -147,6 +149,10 @@ const ContentEditable = ({
|
|
|
147
149
|
editor.setEditable(!disabled);
|
|
148
150
|
}, [disabled]);
|
|
149
151
|
|
|
152
|
+
useEffect(() => {
|
|
153
|
+
initialize?.(editor);
|
|
154
|
+
}, []);
|
|
155
|
+
|
|
150
156
|
return (
|
|
151
157
|
<div
|
|
152
158
|
className={cx(
|
|
@@ -7,7 +7,7 @@ import { HeadingNode } from '@lexical/rich-text';
|
|
|
7
7
|
import { ListItemNode, ListNode } from '@lexical/list';
|
|
8
8
|
import anylogger from 'anylogger';
|
|
9
9
|
import { makeStyles } from 'tss-react/mui';
|
|
10
|
-
import { EditorState } from 'lexical';
|
|
10
|
+
import { EditorState, LexicalEditor } from 'lexical';
|
|
11
11
|
import { LinkPlugin } from '@lexical/react/LexicalLinkPlugin';
|
|
12
12
|
import { equals } from 'ramda';
|
|
13
13
|
import { ListPlugin } from '@lexical/react/LexicalListPlugin';
|
|
@@ -27,8 +27,9 @@ export interface RichTextEditorProps {
|
|
|
27
27
|
editable: boolean;
|
|
28
28
|
editorState?: string;
|
|
29
29
|
error?: string;
|
|
30
|
-
getEditorState?: (editorState: EditorState) => void;
|
|
30
|
+
getEditorState?: (editorState: EditorState, editor: LexicalEditor) => void;
|
|
31
31
|
initialEditorState?: string;
|
|
32
|
+
initialize?: (editor) => void;
|
|
32
33
|
inputClassname?: string;
|
|
33
34
|
minInputHeight?: number;
|
|
34
35
|
namespace?: string;
|
|
@@ -132,7 +133,8 @@ const RichTextEditor = ({
|
|
|
132
133
|
contentClassName,
|
|
133
134
|
displayMacrosButton = false,
|
|
134
135
|
disabled,
|
|
135
|
-
openLinkInNewTab = true
|
|
136
|
+
openLinkInNewTab = true,
|
|
137
|
+
initialize
|
|
136
138
|
}: RichTextEditorProps): JSX.Element => {
|
|
137
139
|
const { classes } = useStyles({ toolbarPositions });
|
|
138
140
|
|
|
@@ -188,6 +190,7 @@ const RichTextEditor = ({
|
|
|
188
190
|
error={error}
|
|
189
191
|
hasInitialTextContent={hasInitialTextContent}
|
|
190
192
|
initialEditorState={initialEditorState}
|
|
193
|
+
initialize={initialize}
|
|
191
194
|
inputClassname={inputClassname}
|
|
192
195
|
minInputHeight={minInputHeight}
|
|
193
196
|
namespace={namespace}
|