fix compilation errors not setting error flag in brush preview
This commit is contained in:
parent
37520f34f7
commit
8356b6c750
|
@ -45,13 +45,21 @@ export class BrushPreview extends HTMLElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
renderBrush(haku) {
|
renderBrush(haku) {
|
||||||
this.classList.remove("error");
|
this.unsetErrorFlag();
|
||||||
let result = this.#renderBrushInner(haku);
|
let result = this.#renderBrushInner(haku);
|
||||||
if (result.status == "error") {
|
if (result.status == "error") {
|
||||||
this.classList.add("error");
|
this.setErrorFlag();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsetErrorFlag() {
|
||||||
|
this.classList.remove("error");
|
||||||
|
}
|
||||||
|
|
||||||
|
setErrorFlag() {
|
||||||
|
this.classList.add("error");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
customElements.define("rkgk-brush-preview", BrushPreview);
|
customElements.define("rkgk-brush-preview", BrushPreview);
|
||||||
|
|
|
@ -265,7 +265,10 @@ function readUrl(urlString) {
|
||||||
let compileResult = currentUser.setBrush(brushEditor.code);
|
let compileResult = currentUser.setBrush(brushEditor.code);
|
||||||
brushEditor.renderHakuResult("Compilation", compileResult);
|
brushEditor.renderHakuResult("Compilation", compileResult);
|
||||||
|
|
||||||
if (compileResult.status != "ok") return;
|
if (compileResult.status != "ok") {
|
||||||
|
brushPreview.setErrorFlag();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let previewResult = brushPreview.renderBrush(currentUser.haku);
|
let previewResult = brushPreview.renderBrush(currentUser.haku);
|
||||||
if (previewResult.status == "error") {
|
if (previewResult.status == "error") {
|
||||||
|
|
Loading…
Reference in a new issue