@centreon/ui 23.10.56 → 23.10.57
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
|
@@ -47,7 +47,7 @@ const useStyles = makeStyles<StyleProps>()(
|
|
|
47
47
|
|
|
48
48
|
interface Props {
|
|
49
49
|
className?: string;
|
|
50
|
-
disabled
|
|
50
|
+
disabled?: boolean;
|
|
51
51
|
editable: boolean;
|
|
52
52
|
editorState?: string;
|
|
53
53
|
error?: string;
|
|
@@ -61,6 +61,9 @@ interface Props {
|
|
|
61
61
|
resetEditorToInitialStateCondition?: () => boolean;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
const defaultState =
|
|
65
|
+
'{"root":{"children":[{"children":[],"direction":null,"format":"","indent":0,"type":"paragraph","version":1}],"direction":null,"format":"","indent":0,"type":"root","version":1}}';
|
|
66
|
+
|
|
64
67
|
const ContentEditable = ({
|
|
65
68
|
minInputHeight,
|
|
66
69
|
inputClassname,
|
|
@@ -91,8 +94,10 @@ const ContentEditable = ({
|
|
|
91
94
|
);
|
|
92
95
|
|
|
93
96
|
useLayoutEffect(() => {
|
|
94
|
-
if (
|
|
95
|
-
const newEditorState = editor.parseEditorState(
|
|
97
|
+
if (!editable) {
|
|
98
|
+
const newEditorState = editor.parseEditorState(
|
|
99
|
+
editorState || defaultState
|
|
100
|
+
);
|
|
96
101
|
|
|
97
102
|
editor.setEditorState(newEditorState);
|
|
98
103
|
}
|
|
@@ -63,6 +63,36 @@ const useStyles = makeStyles<{ toolbarPositions: 'start' | 'end' }>()(
|
|
|
63
63
|
paddingLeft: theme.spacing(1.5),
|
|
64
64
|
paddingTop: theme.spacing(0.5)
|
|
65
65
|
},
|
|
66
|
+
h1: {
|
|
67
|
+
fontSize: theme.typography.h1.fontSize,
|
|
68
|
+
fontWeight: theme.typography.h1.fontWeight,
|
|
69
|
+
lineHeight: theme.typography.h1.lineHeight
|
|
70
|
+
},
|
|
71
|
+
h2: {
|
|
72
|
+
fontSize: theme.typography.h2.fontSize,
|
|
73
|
+
fontWeight: theme.typography.h2.fontWeight,
|
|
74
|
+
lineHeight: theme.typography.h2.lineHeight
|
|
75
|
+
},
|
|
76
|
+
h3: {
|
|
77
|
+
fontSize: theme.typography.h3.fontSize,
|
|
78
|
+
fontWeight: theme.typography.h3.fontWeight,
|
|
79
|
+
lineHeight: theme.typography.h3.lineHeight
|
|
80
|
+
},
|
|
81
|
+
h4: {
|
|
82
|
+
fontSize: theme.typography.h4.fontSize,
|
|
83
|
+
fontWeight: theme.typography.h4.fontWeight,
|
|
84
|
+
lineHeight: theme.typography.h4.lineHeight
|
|
85
|
+
},
|
|
86
|
+
h5: {
|
|
87
|
+
fontSize: theme.typography.h5.fontSize,
|
|
88
|
+
fontWeight: theme.typography.h5.fontWeight,
|
|
89
|
+
lineHeight: theme.typography.h5.lineHeight
|
|
90
|
+
},
|
|
91
|
+
h6: {
|
|
92
|
+
fontSize: theme.typography.h6.fontSize,
|
|
93
|
+
fontWeight: theme.typography.h6.fontWeight,
|
|
94
|
+
lineHeight: theme.typography.h6.lineHeight
|
|
95
|
+
},
|
|
66
96
|
italic: {
|
|
67
97
|
fontStyle: 'italic'
|
|
68
98
|
},
|
|
@@ -101,7 +131,7 @@ const RichTextEditor = ({
|
|
|
101
131
|
onBlur,
|
|
102
132
|
contentClassName,
|
|
103
133
|
displayMacrosButton = false,
|
|
104
|
-
disabled
|
|
134
|
+
disabled,
|
|
105
135
|
openLinkInNewTab = true
|
|
106
136
|
}: RichTextEditorProps): JSX.Element => {
|
|
107
137
|
const { classes } = useStyles({ toolbarPositions });
|
|
@@ -117,6 +147,14 @@ const RichTextEditor = ({
|
|
|
117
147
|
nodes: [AutoLinkNode, LinkNode, HeadingNode, ListNode, ListItemNode],
|
|
118
148
|
onError,
|
|
119
149
|
theme: {
|
|
150
|
+
heading: {
|
|
151
|
+
h1: classes.h1,
|
|
152
|
+
h2: classes.h2,
|
|
153
|
+
h3: classes.h3,
|
|
154
|
+
h4: classes.h4,
|
|
155
|
+
h5: classes.h5,
|
|
156
|
+
h6: classes.h6
|
|
157
|
+
},
|
|
120
158
|
link: classes.link,
|
|
121
159
|
text: {
|
|
122
160
|
bold: classes.bold,
|