From 26eec1152674a7748e86e94edc69ba1eb92b637b Mon Sep 17 00:00:00 2001 From: sawka Date: Sat, 16 Sep 2023 23:07:30 -0700 Subject: [PATCH] add notfound error handler (and fontsize override) to markdown viewer (to match image viewer) --- src/lines.less | 1 - src/view/markdown.tsx | 15 ++++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/lines.less b/src/lines.less index ab1b9f2d..c30caff1 100644 --- a/src/lines.less +++ b/src/lines.less @@ -107,7 +107,6 @@ &.has-rtnstate .terminal-wrapper { padding-bottom: 0; - margin-bottom: -5px; } .image-wrapper { diff --git a/src/view/markdown.tsx b/src/view/markdown.tsx index 03f76d2b..c9cf6d2b 100644 --- a/src/view/markdown.tsx +++ b/src/view/markdown.tsx @@ -21,6 +21,9 @@ class SimpleMarkdownRenderer extends React.Component< componentDidMount() { let dataBlob = this.props.data; + if (dataBlob == null || dataBlob.notFound) { + return; + } if (dataBlob.size > MaxMarkdownSize) { this.markdownError.set(sprintf("error: markdown too large to render size=%d", dataBlob.size)); return; @@ -38,9 +41,19 @@ class SimpleMarkdownRenderer extends React.Component< } render() { + let dataBlob = this.props.data; + if (dataBlob == null || dataBlob.notFound) { + return ( +
+
+ ERROR: file {dataBlob && dataBlob.name ? JSON.stringify(dataBlob.name) : ""} not found +
+
+ ); + } if (this.markdownError.get() != null) { return ( -
+
{this.markdownError.get()}
);