added sanity check
This commit is contained in:
@@ -5,6 +5,7 @@ import { OutputFrame } from "../output-frame/output-frame";
|
||||
import { debounceManager } from "../../../shared/ensure-debounce";
|
||||
import * as sessionApi from '../../../shared/session-api';
|
||||
import { isSessionPage } from "../../../shared/page";
|
||||
import { sanityConvert } from "../../../shared/sanity-code-check";
|
||||
|
||||
export class CodeEditor extends BaseElement {
|
||||
|
||||
@@ -45,13 +46,13 @@ export class CodeEditor extends BaseElement {
|
||||
localStorage.setItem(this.language + "LastInputCache", this.input);
|
||||
debounce.ensureDebounce(() => {
|
||||
sessionApi.setSessionData(this.language, this.input);
|
||||
this.outputFrame.setContent(this.language, this.input);
|
||||
this.outputFrame.setContent(this.language, this.language.toLowerCase() === "javascript" ? sanityConvert(this.input) : this.input);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
this.waitFor(this.outputFrame, () => {
|
||||
this.outputFrame.setContent(this.language, isSessionPage() ? "" : this.input);
|
||||
this.outputFrame.setContent(this.language, isSessionPage() ? "" : (this.language.toLowerCase() === "javascript" ? sanityConvert(this.input) : this.input));
|
||||
});
|
||||
|
||||
}
|
||||
@@ -62,7 +63,7 @@ export class CodeEditor extends BaseElement {
|
||||
this.lastInputCache = this.input;
|
||||
localStorage.setItem(this.language + "LastInputCache", this.input);
|
||||
this.editor.setValue(input);
|
||||
this.outputFrame.setContent(this.language, this.input);
|
||||
this.outputFrame.setContent(this.language, this.language.toLowerCase() === "javascript" ? sanityConvert(this.input) : this.input);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user