v0.4.8-dev New Release #3
@@ -519,6 +519,35 @@ function scheduleSidebarErrors() {
|
||||
});
|
||||
}
|
||||
|
||||
let tocUpdateFrame = null;
|
||||
function scheduleTocUpdate() {
|
||||
if (!toc) return;
|
||||
if (tocUpdateFrame) return;
|
||||
tocUpdateFrame = requestAnimationFrame(() => {
|
||||
tocUpdateFrame = null;
|
||||
updateToc(collectWorkspaces(), collectSites());
|
||||
});
|
||||
}
|
||||
|
||||
const TOC_NAME_INPUT_SELECTOR = [
|
||||
".api-key-name",
|
||||
".api-config-name",
|
||||
".env-config-name",
|
||||
".profile-name",
|
||||
".task-name",
|
||||
".shortcut-name",
|
||||
".workspace-name",
|
||||
".site-name",
|
||||
".site-pattern"
|
||||
].join(", ");
|
||||
|
||||
function handleTocNameInput(event) {
|
||||
const target = event.target;
|
||||
if (!(target instanceof Element)) return;
|
||||
if (!target.matches(TOC_NAME_INPUT_SELECTOR)) return;
|
||||
scheduleTocUpdate();
|
||||
}
|
||||
|
||||
function renderGlobalSitesList(sites) {
|
||||
if (!globalSitesContainer) return;
|
||||
globalSitesContainer.innerHTML = "";
|
||||
@@ -1230,6 +1259,7 @@ function updateApiConfigControls() {
|
||||
if (moveDownBtn) moveDownBtn.disabled = index === cards.length - 1;
|
||||
});
|
||||
scheduleSidebarErrors();
|
||||
scheduleTocUpdate();
|
||||
}
|
||||
|
||||
function buildApiKeyCard(entry) {
|
||||
@@ -1404,6 +1434,7 @@ function updateApiKeyControls() {
|
||||
if (moveDownBtn) moveDownBtn.disabled = index === cards.length - 1;
|
||||
});
|
||||
scheduleSidebarErrors();
|
||||
scheduleTocUpdate();
|
||||
}
|
||||
|
||||
function updateApiConfigKeyOptions() {
|
||||
@@ -1630,6 +1661,7 @@ function updateEnvControls(container = envConfigsContainer) {
|
||||
if (moveDownBtn) moveDownBtn.disabled = index === cards.length - 1;
|
||||
});
|
||||
scheduleSidebarErrors();
|
||||
scheduleTocUpdate();
|
||||
}
|
||||
|
||||
function updateTaskEnvOptionsForContainer(container, envs, allEnvsById) {
|
||||
@@ -1879,6 +1911,7 @@ function updateProfileControls(container = profilesContainer) {
|
||||
if (moveDownBtn) moveDownBtn.disabled = index === cards.length - 1;
|
||||
});
|
||||
scheduleSidebarErrors();
|
||||
scheduleTocUpdate();
|
||||
}
|
||||
|
||||
function updateTaskProfileOptionsForContainer(container, profiles, allProfilesById) {
|
||||
@@ -5034,6 +5067,7 @@ function updateShortcutControls(container = shortcutsContainer) {
|
||||
if (moveDownBtn) moveDownBtn.disabled = index === cards.length - 1;
|
||||
});
|
||||
scheduleSidebarErrors();
|
||||
scheduleTocUpdate();
|
||||
}
|
||||
|
||||
function updateTaskControls(container = tasksContainer) {
|
||||
@@ -5047,6 +5081,7 @@ function updateTaskControls(container = tasksContainer) {
|
||||
if (moveDownBtn) moveDownBtn.disabled = index === cards.length - 1;
|
||||
});
|
||||
scheduleSidebarErrors();
|
||||
scheduleTocUpdate();
|
||||
}
|
||||
|
||||
function collectTasks(container = tasksContainer) {
|
||||
@@ -6117,6 +6152,9 @@ async function initSettings() {
|
||||
registerAllDetails();
|
||||
restoreScrollPosition();
|
||||
initDirtyObserver();
|
||||
if (settingsLayout) {
|
||||
settingsLayout.addEventListener("input", handleTocNameInput);
|
||||
}
|
||||
captureSavedSnapshot();
|
||||
suppressDirtyTracking = false;
|
||||
window.addEventListener("scroll", handleSettingsScroll, { passive: true });
|
||||
|
||||
Reference in New Issue
Block a user