fix compilation errors not setting error flag in brush preview

This commit is contained in:
liquidex 2024-09-08 12:12:33 +02:00
parent 37520f34f7
commit 8356b6c750
2 changed files with 14 additions and 3 deletions

View file

@ -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);

View file

@ -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") {