@madie/madie-design-system 1.2.70 → 1.2.72
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/components/RichTextEditor/index.jsx +31 -31
- package/dist/browser.js +1 -1
- package/dist/index.js +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/index.js.map +1 -1
- package/package.json +9 -2
- package/styles/components/_rich-text-editor.scss +6 -6
- package/styles/qppds/components/_rich-text-editor.scss +6 -6
|
@@ -242,7 +242,7 @@ const MenuBar = ({ editor, disabled }) => {
|
|
|
242
242
|
disabled={disabled}
|
|
243
243
|
type="button"
|
|
244
244
|
>
|
|
245
|
-
|
|
245
|
+
|
|
246
246
|
<TableChartIcon />
|
|
247
247
|
</IconButton>
|
|
248
248
|
</Tooltip>
|
|
@@ -370,6 +370,19 @@ const RichTextEditor = ({
|
|
|
370
370
|
disabled = false,
|
|
371
371
|
readOnly = false,
|
|
372
372
|
}) => {
|
|
373
|
+
if(readOnly) {
|
|
374
|
+
return (
|
|
375
|
+
<p
|
|
376
|
+
className="rich-text-editor_read_only"
|
|
377
|
+
data-testid={`${id}-value`}
|
|
378
|
+
aria-labelledby={`${id}-label`}
|
|
379
|
+
dangerouslySetInnerHTML={{
|
|
380
|
+
__html: content ? DOMPurify.sanitize(content) : "-",
|
|
381
|
+
}}
|
|
382
|
+
/>
|
|
383
|
+
);
|
|
384
|
+
}
|
|
385
|
+
|
|
373
386
|
const editor = useEditor({
|
|
374
387
|
parseOptions: {
|
|
375
388
|
preserveWhitespace: 'full',
|
|
@@ -400,7 +413,7 @@ const RichTextEditor = ({
|
|
|
400
413
|
onUpdate: ({ editor }) => {
|
|
401
414
|
const newValue = editor.getHTML();
|
|
402
415
|
onChange?.(newValue);
|
|
403
|
-
},
|
|
416
|
+
},
|
|
404
417
|
});
|
|
405
418
|
|
|
406
419
|
React.useEffect(() => {
|
|
@@ -493,36 +506,23 @@ const RichTextEditor = ({
|
|
|
493
506
|
{helperText}
|
|
494
507
|
</FormHelperText>
|
|
495
508
|
)}
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
data-testid=
|
|
509
|
+
<>
|
|
510
|
+
<MenuBar editor={editor} disabled={disabled} />
|
|
511
|
+
<EditorContent
|
|
512
|
+
id={id}
|
|
513
|
+
tabIndex={0}
|
|
514
|
+
data-testid="rich-text-editor-content"
|
|
515
|
+
editor={editor}
|
|
502
516
|
aria-labelledby={`${id}-label`}
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
}
|
|
517
|
+
aria-describedby={
|
|
518
|
+
helperText ? `${id}-helper-text` : undefined
|
|
519
|
+
}
|
|
520
|
+
aria-multiline="true"
|
|
521
|
+
aria-required={required || undefined}
|
|
522
|
+
aria-invalid={error || undefined}
|
|
523
|
+
className={`${error ? "has-error" : ""}`}
|
|
506
524
|
/>
|
|
507
|
-
|
|
508
|
-
<>
|
|
509
|
-
<MenuBar editor={editor} disabled={disabled} />
|
|
510
|
-
<EditorContent
|
|
511
|
-
id={id}
|
|
512
|
-
tabIndex={0}
|
|
513
|
-
data-testid="rich-text-editor-content"
|
|
514
|
-
editor={editor}
|
|
515
|
-
aria-labelledby={`${id}-label`}
|
|
516
|
-
aria-describedby={
|
|
517
|
-
helperText ? `${id}-helper-text` : undefined
|
|
518
|
-
}
|
|
519
|
-
aria-multiline="true"
|
|
520
|
-
aria-required={required || undefined}
|
|
521
|
-
aria-invalid={error || undefined}
|
|
522
|
-
className={`ProseMirror ${error ? "has-error" : ""}`}
|
|
523
|
-
/>
|
|
524
|
-
</>
|
|
525
|
-
)}
|
|
525
|
+
</>
|
|
526
526
|
</div>
|
|
527
527
|
);
|
|
528
528
|
};
|
|
@@ -546,4 +546,4 @@ MenuBar.propTypes = {
|
|
|
546
546
|
disabled: PropTypes.bool,
|
|
547
547
|
};
|
|
548
548
|
|
|
549
|
-
export default RichTextEditor;
|
|
549
|
+
export default RichTextEditor;
|