X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/eb909803c6fe3c99894ac402a88ea7cbc114f66b..fb10daa75864def53d1f0ffa7da3cece8cebe9d0:/src/components/rich-text-editor-link/rich-text-editor-link.tsx

diff --git a/src/components/rich-text-editor-link/rich-text-editor-link.tsx b/src/components/rich-text-editor-link/rich-text-editor-link.tsx
index ca942d78..68a8c035 100644
--- a/src/components/rich-text-editor-link/rich-text-editor-link.tsx
+++ b/src/components/rich-text-editor-link/rich-text-editor-link.tsx
@@ -2,11 +2,12 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import * as React from 'react';
-import { DispatchProp } from 'react-redux';
+import React from 'react';
+import { Dispatch } from 'redux';
+import { connect } from 'react-redux';
 import { withStyles, StyleRulesCallback, WithStyles, Typography } from '@material-ui/core';
-import { ArvadosTheme } from '~/common/custom-theme';
-import { openRichTextEditorDialog } from '~/store/rich-text-editor-dialog/rich-text-editor-dialog-actions';
+import { ArvadosTheme } from 'common/custom-theme';
+import { openRichTextEditorDialog } from 'store/rich-text-editor-dialog/rich-text-editor-dialog-actions';
 
 type CssRules = "root";
 
@@ -23,13 +24,20 @@ interface RichTextEditorLinkData {
     content: string;
 }
 
-type RichTextEditorLinkProps = RichTextEditorLinkData & WithStyles<CssRules>;
+interface RichTextEditorLinkActions {
+    onClick: (title: string, content: string) => void;
+}
+
+type RichTextEditorLinkProps = RichTextEditorLinkData & RichTextEditorLinkActions & WithStyles<CssRules>;
+
+const mapDispatchToProps = (dispatch: Dispatch) => ({
+    onClick: (title: string, content: string) => dispatch<any>(openRichTextEditorDialog(title, content))
+});
 
-export const RichTextEditorLink = withStyles(styles)(
-    ({ classes, title, content, label }: RichTextEditorLinkProps) =>
-        <Typography component='span' className={classes.root} 
-            // onClick={() => dispatch<any>(openRichTextEditorDialog(title, content))}
-            >
+export const RichTextEditorLink = connect(undefined, mapDispatchToProps)(
+    withStyles(styles)(({ classes, title, content, label, onClick }: RichTextEditorLinkProps) =>
+        <Typography component='span' className={classes.root}
+            onClick={() => onClick(title, content) }>
             {label}
         </Typography>
-);
\ No newline at end of file
+    ));
\ No newline at end of file
