fix: webui unexpected save-btn when file is non-editable (#429)

This commit is contained in:
sigoden 2024-08-07 20:38:12 +08:00 committed by GitHub
parent 3727dec115
commit 5d26103ea2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -603,9 +603,11 @@ async function setupEditorPage() {
});
});
const $saveBtn = document.querySelector(".save-btn");
$saveBtn.classList.remove("hidden");
$saveBtn.addEventListener("click", saveChange);
if (DATA.editable) {
const $saveBtn = document.querySelector(".save-btn");
$saveBtn.classList.remove("hidden");
$saveBtn.addEventListener("click", saveChange);
}
} else if (DATA.kind == "View") {
$editor.readonly = true;
}