mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-21 16:38:23 +01:00
don't load remote content, and dont show codeeditor if closed
This commit is contained in:
parent
8daac68aad
commit
379854e049
@ -418,6 +418,11 @@ a.a-block {
|
||||
padding-top: 5px;
|
||||
}
|
||||
|
||||
.plugin-info-text {
|
||||
color: @term-white;
|
||||
padding-top: 5px;
|
||||
}
|
||||
|
||||
.view-error {
|
||||
padding: 10px 20px;
|
||||
}
|
||||
|
@ -71,12 +71,13 @@ class SourceCodeRenderer extends React.Component<
|
||||
const editorHeight = Math.max(props.savedHeight - 25, 0); // must subtract the padding/margin to get the real editorHeight
|
||||
this.markdownRef = React.createRef();
|
||||
this.syncing = false;
|
||||
let isClosed = props.lineState["prompt:closed"];
|
||||
this.state = {
|
||||
code: null,
|
||||
languages: [],
|
||||
selectedLanguage: "",
|
||||
isSave: false,
|
||||
isClosed: false,
|
||||
isClosed: isClosed,
|
||||
editorHeight,
|
||||
message: null,
|
||||
isPreviewerAvailable: false,
|
||||
@ -92,11 +93,11 @@ class SourceCodeRenderer extends React.Component<
|
||||
this.cacheKey = `${screenId}-${lineId}-${this.filePath}`;
|
||||
const code = SourceCodeRenderer.codeCache.get(this.cacheKey);
|
||||
if (code) {
|
||||
this.setState({ code, isClosed: this.props.lineState["prompt:closed"] });
|
||||
this.setState({ code });
|
||||
} else {
|
||||
this.props.data.text().then((code) => {
|
||||
this.originalCode = code;
|
||||
this.setState({ code, isClosed: this.props.lineState["prompt:closed"] });
|
||||
this.setState({ code });
|
||||
SourceCodeRenderer.codeCache.set(this.cacheKey, code);
|
||||
});
|
||||
}
|
||||
@ -417,10 +418,13 @@ class SourceCodeRenderer extends React.Component<
|
||||
render() {
|
||||
const { exitcode } = this.props;
|
||||
const { code, message, isPreviewerAvailable, showPreview, editorFraction } = this.state;
|
||||
|
||||
if (code == null) return <div className="code-renderer" style={{ height: this.props.savedHeight }} />;
|
||||
|
||||
if (exitcode === 1)
|
||||
if (this.state.isClosed) {
|
||||
return <div className="code-renderer"></div>;
|
||||
}
|
||||
if (code == null) {
|
||||
return <div className="code-renderer" style={{ height: this.props.savedHeight }} />;
|
||||
}
|
||||
if (exitcode === 1) {
|
||||
return (
|
||||
<div
|
||||
className="code-renderer"
|
||||
@ -432,7 +436,7 @@ class SourceCodeRenderer extends React.Component<
|
||||
{code}
|
||||
</div>
|
||||
);
|
||||
|
||||
}
|
||||
return (
|
||||
<div className="code-renderer">
|
||||
<Split sizes={[editorFraction, 1 - editorFraction]} onSetSizes={this.setSizes}>
|
||||
|
@ -41,9 +41,11 @@ class SimpleBlobRendererModel {
|
||||
dataBlob: T.ExtBlob;
|
||||
readOnly: boolean;
|
||||
notFound: boolean;
|
||||
isClosed: boolean;
|
||||
|
||||
initialize(params: RendererModelInitializeParams): void {
|
||||
this.loading = mobx.observable.box(true, { name: "renderer-loading" });
|
||||
this.isClosed = !!params.lineState["prompt:closed"];
|
||||
this.loading = mobx.observable.box(!this.isClosed, { name: "renderer-loading" });
|
||||
this.isDone = mobx.observable.box(params.isDone, {
|
||||
name: "renderer-isDone",
|
||||
});
|
||||
@ -53,8 +55,13 @@ class SimpleBlobRendererModel {
|
||||
this.lineState = params.lineState;
|
||||
this.savedHeight = params.savedHeight;
|
||||
this.ptyDataSource = params.ptyDataSource;
|
||||
if (this.isDone.get()) {
|
||||
setTimeout(() => this.reload(0), 10);
|
||||
if (this.isClosed) {
|
||||
this.dataBlob = new Blob();
|
||||
this.dataBlob.notFound = false; // TODO
|
||||
} else {
|
||||
if (this.isDone.get()) {
|
||||
setTimeout(() => this.reload(0), 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user