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';
7 import { Dialog, DialogTitle, DialogContent, DialogActions, Button } from "@mui/material";
8 import { WithStyles } from '@mui/styles';
9 import withStyles from '@mui/styles/withStyles';
10 import { ArvadosTheme } from 'common/custom-theme';
11 import { WithDialogProps } from "store/dialog/with-dialog";
12 import { withDialog } from 'store/dialog/with-dialog';
13 import { RICH_TEXT_EDITOR_DIALOG_NAME } from "store/rich-text-editor-dialog/rich-text-editor-dialog-actions";
14 import RichTextEditor from 'react-rte';
16 type CssRules = 'rte';
18 const styles: CustomStyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
22 textDecoration: 'none',
23 color: theme.palette.primary.main,
26 textDecoration: 'underline'
33 export interface RichTextEditorDialogDataProps {
38 export const RichTextEditorDialog = withStyles(styles)(withDialog(RICH_TEXT_EDITOR_DIALOG_NAME)(
39 (props: WithDialogProps<RichTextEditorDialogDataProps> & WithStyles<CssRules>) =>
40 <Dialog open={props.open}
41 onClose={props.closeDialog}
44 <DialogTitle>{props.data.title}</DialogTitle>
47 className={props.classes.rte}
48 value={props.data.text ?
49 RichTextEditor.createValueFromString(props.data.text.replace(/</g, '<').replace(/>/g, '>').replace(/&/g, '&'), 'html') : ''}
56 onClick={props.closeDialog}>