mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-11-01 00:03:53 +08:00
1 parent
938d6afd97
commit
33245bbb75
2 files changed
+21
-6
No files matched your search
@@ -431,12 +431,12 @@ select:disabled {
|
|||||||
opacity: 0.48;
|
opacity: 0.48;
|
||||||
}
|
}
|
||||||
|
|
||||||
body[data-busy] :is(button, input, textarea, select):disabled,
|
body[data-busy] [data-busy-disabled]:disabled,
|
||||||
body[data-busy] .editor-number:has(input:disabled),
|
body[data-busy] .editor-number:has(input[data-busy-disabled]:disabled),
|
||||||
body[data-busy] :is(.toolbar-select, .form-select):has(select:disabled) > span,
|
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:disabled)::after,
|
body[data-busy] :is(.toolbar-select, .form-select):has(select[data-busy-disabled]:disabled)::after,
|
||||||
body[data-busy] .form-options input:disabled + span {
|
body[data-busy] .form-options input[data-busy-disabled]:disabled + span {
|
||||||
transition: opacity 0.16s ease 0.16s;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
button:focus-visible,
|
button:focus-visible,
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ let confirmationTask = Promise.resolve();
|
|||||||
let cancelPageTouch = null;
|
let cancelPageTouch = null;
|
||||||
|
|
||||||
const workspace = { tabs: [], active: null, sequence: 0, nextID: 0, switching: false, closing: false, objectClipboard: null, textClipboard: null };
|
const workspace = { tabs: [], active: null, sequence: 0, nextID: 0, switching: false, closing: false, objectClipboard: null, textClipboard: null };
|
||||||
|
const busyControls = new Set();
|
||||||
|
|
||||||
function createResourceManager() {
|
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 };
|
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) {
|
function attachDocumentTab(tab) {
|
||||||
|
clearBusyControls();
|
||||||
copyApplicationPreferences(tab.state);
|
copyApplicationPreferences(tab.state);
|
||||||
workspace.active = tab;
|
workspace.active = tab;
|
||||||
tab.touched = Date.now();
|
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()) {
|
function setBusy(busy, text = "", percent = 0, status = "", tab = documentTab()) {
|
||||||
const operation = operationRequest(tab);
|
const operation = operationRequest(tab);
|
||||||
if (!busy && operation) tab.preparationBusy = true;
|
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 (text) tab.progress = {text, percent};
|
||||||
if (status) tab.status = status;
|
if (status) tab.status = status;
|
||||||
if (!isForegroundDocument(tab)) return;
|
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);
|
document.body.toggleAttribute("data-busy", busy);
|
||||||
el.newButton.disabled = false;
|
el.newButton.disabled = false;
|
||||||
el.documentNewTab.disabled = workspace.closing;
|
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.editorTools.inert = busy || Boolean(sealPreview || resourceManager.pick);
|
||||||
el.fontList.inert = busy;
|
el.fontList.inert = busy;
|
||||||
el.docFontList.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 (!busy) {
|
||||||
if (resumeSearch) queueMicrotask(() => {
|
if (resumeSearch) queueMicrotask(() => {
|
||||||
if (isForegroundDocument(tab) && !tab.busy && !tab.refreshPending && tab.state.searchPaused) searchDocument();
|
if (isForegroundDocument(tab) && !tab.busy && !tab.refreshPending && tab.state.searchPaused) searchDocument();
|
||||||
|
|||||||
Reference in new issue
Block a user