add notfound error handler (and fontsize override) to markdown viewer (to match image viewer)

This commit is contained in:
sawka 2023-09-16 23:07:30 -07:00
parent 8a4ff84e95
commit 26eec11526
2 changed files with 14 additions and 2 deletions

View File

@ -107,7 +107,6 @@
&.has-rtnstate .terminal-wrapper {
padding-bottom: 0;
margin-bottom: -5px;
}
.image-wrapper {

View File

@ -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 (
<div className="renderer-container image-renderer" style={{ fontSize: this.props.opts.termFontSize }}>
<div className="load-error-text">
ERROR: file {dataBlob && dataBlob.name ? JSON.stringify(dataBlob.name) : ""} not found
</div>
</div>
);
}
if (this.markdownError.get() != null) {
return (
<div className="renderer-container markdown-renderer">
<div className="renderer-container markdown-renderer" style={{ fontSize: this.props.opts.termFontSize }}>
<div className="error-container">{this.markdownError.get()}</div>
</div>
);