From 5d26103ea201119a6683ed709f621c52b409f01b Mon Sep 17 00:00:00 2001 From: sigoden Date: Wed, 7 Aug 2024 20:38:12 +0800 Subject: [PATCH] fix: webui unexpected save-btn when file is non-editable (#429) --- assets/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/assets/index.js b/assets/index.js index 24883a0..bb3a5da 100644 --- a/assets/index.js +++ b/assets/index.js @@ -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; }