From 33245bbb756646eb3e09f1317c8ccb6b93341ee9 Mon Sep 17 00:00:00 2001 From: xiaoqidun Date: Sat, 31 Oct 2026 23:03:37 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=87=E5=AD=97=E6=A0=BC=E5=BC=8F=E5=8F=8A?= =?UTF-8?q?=E6=8B=96=E5=8A=A8=E5=90=8E=E7=9A=84=E9=97=AA=E7=83=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/webui/ofdgo.css | 12 ++++++------ assets/webui/ofdgo.js | 15 +++++++++++++++ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/assets/webui/ofdgo.css b/assets/webui/ofdgo.css index 6e43ff2..bc237b9 100644 --- a/assets/webui/ofdgo.css +++ b/assets/webui/ofdgo.css @@ -431,12 +431,12 @@ select:disabled { opacity: 0.48; } -body[data-busy] :is(button, input, textarea, select):disabled, -body[data-busy] .editor-number:has(input:disabled), -body[data-busy] :is(.toolbar-select, .form-select):has(select:disabled) > span, -body[data-busy] :is(.toolbar-select, .form-select):has(select:disabled)::after, -body[data-busy] .form-options input:disabled + span { - transition: opacity 0.16s ease 0.16s; +body[data-busy] [data-busy-disabled]:disabled, +body[data-busy] .editor-number:has(input[data-busy-disabled]:disabled), +body[data-busy] :is(.toolbar-select, .form-select):has(select[data-busy-disabled]:disabled) > span, +body[data-busy] :is(.toolbar-select, .form-select):has(select[data-busy-disabled]:disabled)::after, +body[data-busy] .form-options input[data-busy-disabled]:disabled + span { + opacity: 1; } button:focus-visible, diff --git a/assets/webui/ofdgo.js b/assets/webui/ofdgo.js index a6f9aa5..b8bc3bb 100644 --- a/assets/webui/ofdgo.js +++ b/assets/webui/ofdgo.js @@ -44,6 +44,7 @@ let confirmationTask = Promise.resolve(); let cancelPageTouch = null; const workspace = { tabs: [], active: null, sequence: 0, nextID: 0, switching: false, closing: false, objectClipboard: null, textClipboard: null }; +const busyControls = new Set(); function createResourceManager() { return { kind: "Font", scope: "", views: new Map(), items: [], filteredItems: [], start: -1, end: -1, selected: null, references: [], referenceOffset: 0, targets: [], pick: null, busy: false, sequence: 0, url: null, fileAction: null }; @@ -2992,6 +2993,7 @@ function detachDocumentView() { } function attachDocumentTab(tab) { + clearBusyControls(); copyApplicationPreferences(tab.state); workspace.active = tab; tab.touched = Date.now(); @@ -13406,6 +13408,11 @@ function showError(err, empty = !state.doc) { } } +function clearBusyControls() { + for (const control of busyControls) control.removeAttribute("data-busy-disabled"); + busyControls.clear(); +} + function setBusy(busy, text = "", percent = 0, status = "", tab = documentTab()) { const operation = operationRequest(tab); if (!busy && operation) tab.preparationBusy = true; @@ -13416,6 +13423,9 @@ function setBusy(busy, text = "", percent = 0, status = "", tab = documentTab()) if (text) tab.progress = {text, percent}; if (status) tab.status = status; if (!isForegroundDocument(tab)) return; + const editing = busy && tab.editTask && !operation && !text; + if (!editing) clearBusyControls(); + const controls = editing ? document.querySelectorAll("button:enabled, input:enabled, textarea:enabled, select:enabled") : []; document.body.toggleAttribute("data-busy", busy); el.newButton.disabled = false; el.documentNewTab.disabled = workspace.closing; @@ -13452,6 +13462,11 @@ function setBusy(busy, text = "", percent = 0, status = "", tab = documentTab()) el.editorTools.inert = busy || Boolean(sealPreview || resourceManager.pick); el.fontList.inert = busy; el.docFontList.inert = busy; + for (const control of controls) { + if (!control.disabled) continue; + control.setAttribute("data-busy-disabled", ""); + busyControls.add(control); + } if (!busy) { if (resumeSearch) queueMicrotask(() => { if (isForegroundDocument(tab) && !tab.busy && !tab.refreshPending && tab.state.searchPaused) searchDocument();