mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-22 16:48:23 +01:00
add notfound error handler (and fontsize override) to markdown viewer (to match image viewer)
This commit is contained in:
parent
8a4ff84e95
commit
26eec11526
@ -107,7 +107,6 @@
|
||||
|
||||
&.has-rtnstate .terminal-wrapper {
|
||||
padding-bottom: 0;
|
||||
margin-bottom: -5px;
|
||||
}
|
||||
|
||||
.image-wrapper {
|
||||
|
@ -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>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user