mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-22 16:48: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;
|
padding-top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.plugin-info-text {
|
||||||
|
color: @term-white;
|
||||||
|
padding-top: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
.view-error {
|
.view-error {
|
||||||
padding: 10px 20px;
|
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
|
const editorHeight = Math.max(props.savedHeight - 25, 0); // must subtract the padding/margin to get the real editorHeight
|
||||||
this.markdownRef = React.createRef();
|
this.markdownRef = React.createRef();
|
||||||
this.syncing = false;
|
this.syncing = false;
|
||||||
|
let isClosed = props.lineState["prompt:closed"];
|
||||||
this.state = {
|
this.state = {
|
||||||
code: null,
|
code: null,
|
||||||
languages: [],
|
languages: [],
|
||||||
selectedLanguage: "",
|
selectedLanguage: "",
|
||||||
isSave: false,
|
isSave: false,
|
||||||
isClosed: false,
|
isClosed: isClosed,
|
||||||
editorHeight,
|
editorHeight,
|
||||||
message: null,
|
message: null,
|
||||||
isPreviewerAvailable: false,
|
isPreviewerAvailable: false,
|
||||||
@ -92,11 +93,11 @@ class SourceCodeRenderer extends React.Component<
|
|||||||
this.cacheKey = `${screenId}-${lineId}-${this.filePath}`;
|
this.cacheKey = `${screenId}-${lineId}-${this.filePath}`;
|
||||||
const code = SourceCodeRenderer.codeCache.get(this.cacheKey);
|
const code = SourceCodeRenderer.codeCache.get(this.cacheKey);
|
||||||
if (code) {
|
if (code) {
|
||||||
this.setState({ code, isClosed: this.props.lineState["prompt:closed"] });
|
this.setState({ code });
|
||||||
} else {
|
} else {
|
||||||
this.props.data.text().then((code) => {
|
this.props.data.text().then((code) => {
|
||||||
this.originalCode = code;
|
this.originalCode = code;
|
||||||
this.setState({ code, isClosed: this.props.lineState["prompt:closed"] });
|
this.setState({ code });
|
||||||
SourceCodeRenderer.codeCache.set(this.cacheKey, code);
|
SourceCodeRenderer.codeCache.set(this.cacheKey, code);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -417,10 +418,13 @@ class SourceCodeRenderer extends React.Component<
|
|||||||
render() {
|
render() {
|
||||||
const { exitcode } = this.props;
|
const { exitcode } = this.props;
|
||||||
const { code, message, isPreviewerAvailable, showPreview, editorFraction } = this.state;
|
const { code, message, isPreviewerAvailable, showPreview, editorFraction } = this.state;
|
||||||
|
if (this.state.isClosed) {
|
||||||
if (code == null) return <div className="code-renderer" style={{ height: this.props.savedHeight }} />;
|
return <div className="code-renderer"></div>;
|
||||||
|
}
|
||||||
if (exitcode === 1)
|
if (code == null) {
|
||||||
|
return <div className="code-renderer" style={{ height: this.props.savedHeight }} />;
|
||||||
|
}
|
||||||
|
if (exitcode === 1) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="code-renderer"
|
className="code-renderer"
|
||||||
@ -432,7 +436,7 @@ class SourceCodeRenderer extends React.Component<
|
|||||||
{code}
|
{code}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<div className="code-renderer">
|
<div className="code-renderer">
|
||||||
<Split sizes={[editorFraction, 1 - editorFraction]} onSetSizes={this.setSizes}>
|
<Split sizes={[editorFraction, 1 - editorFraction]} onSetSizes={this.setSizes}>
|
||||||
|
@ -41,9 +41,11 @@ class SimpleBlobRendererModel {
|
|||||||
dataBlob: T.ExtBlob;
|
dataBlob: T.ExtBlob;
|
||||||
readOnly: boolean;
|
readOnly: boolean;
|
||||||
notFound: boolean;
|
notFound: boolean;
|
||||||
|
isClosed: boolean;
|
||||||
|
|
||||||
initialize(params: RendererModelInitializeParams): void {
|
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, {
|
this.isDone = mobx.observable.box(params.isDone, {
|
||||||
name: "renderer-isDone",
|
name: "renderer-isDone",
|
||||||
});
|
});
|
||||||
@ -53,8 +55,13 @@ class SimpleBlobRendererModel {
|
|||||||
this.lineState = params.lineState;
|
this.lineState = params.lineState;
|
||||||
this.savedHeight = params.savedHeight;
|
this.savedHeight = params.savedHeight;
|
||||||
this.ptyDataSource = params.ptyDataSource;
|
this.ptyDataSource = params.ptyDataSource;
|
||||||
if (this.isDone.get()) {
|
if (this.isClosed) {
|
||||||
setTimeout(() => this.reload(0), 10);
|
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