1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import React from "react";
6 import { CustomStyleRulesCallback } from 'common/custom-theme';
15 } from "@material-ui/core";
16 import { ArvadosTheme } from 'common/custom-theme';
17 import { WithDialogProps } from "store/dialog/with-dialog";
18 import { withDialog } from 'store/dialog/with-dialog';
19 import { RICH_TEXT_EDITOR_DIALOG_NAME } from "store/rich-text-editor-dialog/rich-text-editor-dialog-actions";
20 import RichTextEditor from 'react-rte';
22 type CssRules = 'rte';
24 const styles: CustomStyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
28 textDecoration: 'none',
29 color: theme.palette.primary.main,
32 textDecoration: 'underline'
39 export interface RichTextEditorDialogDataProps {
44 export const RichTextEditorDialog = withStyles(styles)(withDialog(RICH_TEXT_EDITOR_DIALOG_NAME)(
45 (props: WithDialogProps<RichTextEditorDialogDataProps> & WithStyles<CssRules>) =>
46 <Dialog open={props.open}
47 onClose={props.closeDialog}
50 <DialogTitle>{props.data.title}</DialogTitle>
53 className={props.classes.rte}
54 value={props.data.text ?
55 RichTextEditor.createValueFromString(props.data.text.replace(/</g, '<').replace(/>/g, '>').replace(/&/g, '&'), 'html') : ''}
62 onClick={props.closeDialog}>