From 42219ab655090ea1194e1b8e280ed8e86b31abbe Mon Sep 17 00:00:00 2001 From: ludovicm67 Date: Thu, 23 Jan 2020 21:36:49 +0100 Subject: webui: custom image tag --- webui/src/Content.js | 7 ++++++- webui/src/tag/ImageTag.js | 15 +++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 webui/src/tag/ImageTag.js diff --git a/webui/src/Content.js b/webui/src/Content.js index 19f57631..737c5ab2 100644 --- a/webui/src/Content.js +++ b/webui/src/Content.js @@ -2,12 +2,17 @@ import unified from 'unified'; import parse from 'remark-parse'; import html from 'remark-html'; import remark2react from 'remark-react'; +import ImageTag from './tag/ImageTag'; const Content = ({ markdown }) => { const processor = unified() .use(parse) .use(html) - .use(remark2react); + .use(remark2react, { + remarkReactComponents: { + img: ImageTag, + }, + }); return processor.processSync(markdown).contents; }; diff --git a/webui/src/tag/ImageTag.js b/webui/src/tag/ImageTag.js new file mode 100644 index 00000000..aea65e9d --- /dev/null +++ b/webui/src/tag/ImageTag.js @@ -0,0 +1,15 @@ +import React from 'react'; +import { makeStyles } from '@material-ui/styles'; + +const useStyles = makeStyles({ + tag: { + maxWidth: '100%', + }, +}); + +const ImageTag = (props) => { + const classes = useStyles(); + return +}; + +export default ImageTag; \ No newline at end of file -- cgit From e08ecf1a7f8d93b584c0c5130e4333d6621a4c52 Mon Sep 17 00:00:00 2001 From: ludovicm67 Date: Thu, 23 Jan 2020 21:40:53 +0100 Subject: webui: fix column width on bug --- webui/src/bug/Bug.js | 1 + 1 file changed, 1 insertion(+) diff --git a/webui/src/bug/Bug.js b/webui/src/bug/Bug.js index 19b8b9ce..5a159f0f 100644 --- a/webui/src/bug/Bug.js +++ b/webui/src/bug/Bug.js @@ -31,6 +31,7 @@ const useStyles = makeStyles(theme => ({ flex: 1, marginTop: theme.spacing(2), marginRight: theme.spacing(2), + minWidth: 0, }, sidebar: { marginTop: theme.spacing(2), -- cgit From 3413ee448a79686381624a414b18debd09120b9e Mon Sep 17 00:00:00 2001 From: ludovicm67 Date: Thu, 23 Jan 2020 21:50:20 +0100 Subject: webui: open image in a new tab on click --- webui/src/tag/ImageTag.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/webui/src/tag/ImageTag.js b/webui/src/tag/ImageTag.js index aea65e9d..b0f0c1c8 100644 --- a/webui/src/tag/ImageTag.js +++ b/webui/src/tag/ImageTag.js @@ -7,9 +7,13 @@ const useStyles = makeStyles({ }, }); -const ImageTag = (props) => { +const ImageTag = ({ alt, ...props }) => { const classes = useStyles(); - return + return ( + + {alt} + + ); }; -export default ImageTag; \ No newline at end of file +export default ImageTag; -- cgit From e364674850d527fe3a3c9bb8e3745ee619784636 Mon Sep 17 00:00:00 2001 From: ludovicm67 Date: Thu, 23 Jan 2020 22:03:22 +0100 Subject: webui: fix width for pre tags in bug messages --- webui/src/Content.js | 2 ++ webui/src/bug/Message.js | 1 + webui/src/tag/PreTag.js | 16 ++++++++++++++++ 3 files changed, 19 insertions(+) create mode 100644 webui/src/tag/PreTag.js diff --git a/webui/src/Content.js b/webui/src/Content.js index 737c5ab2..3a6900bc 100644 --- a/webui/src/Content.js +++ b/webui/src/Content.js @@ -3,6 +3,7 @@ import parse from 'remark-parse'; import html from 'remark-html'; import remark2react from 'remark-react'; import ImageTag from './tag/ImageTag'; +import PreTag from './tag/PreTag'; const Content = ({ markdown }) => { const processor = unified() @@ -11,6 +12,7 @@ const Content = ({ markdown }) => { .use(remark2react, { remarkReactComponents: { img: ImageTag, + pre: PreTag, }, }); diff --git a/webui/src/bug/Message.js b/webui/src/bug/Message.js index db67a3f5..06c12815 100644 --- a/webui/src/bug/Message.js +++ b/webui/src/bug/Message.js @@ -20,6 +20,7 @@ const useStyles = makeStyles(theme => ({ bubble: { flex: 1, marginLeft: theme.spacing(1), + minWidth: 0, }, header: { ...theme.typography.body1, diff --git a/webui/src/tag/PreTag.js b/webui/src/tag/PreTag.js new file mode 100644 index 00000000..c2440df9 --- /dev/null +++ b/webui/src/tag/PreTag.js @@ -0,0 +1,16 @@ +import React from 'react'; +import { makeStyles } from '@material-ui/styles'; + +const useStyles = makeStyles({ + tag: { + maxWidth: '100%', + overflowX: 'auto', + }, +}); + +const PreTag = props => { + const classes = useStyles(); + return
;
+};
+
+export default PreTag;
-- 
cgit