An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Align collection manager tabs with shared dialog layout
Danielf023dd41c50e
diff --git a/app/src/assets/scss/business/_av.scss b/app/src/assets/scss/business/_av.scssindex 6c9489b437..8cdb62725c 100644--- a/app/src/assets/scss/business/_av.scss+++ b/app/src/assets/scss/business/_av.scss@@ -3370,15 +3370,13 @@ img.av__cellassetimg {display: flex;flex-direction: column;gap: 16px;+}- .layout-tab-bar {- flex-shrink: 0;- }+.av__collection-tabs {+ flex-shrink: 0;.item {min-width: 0;- height: auto;- min-height: 40px;.item__text {white-space: normal;diff --git a/app/src/protyle/render/av/collectionReview.ts b/app/src/protyle/render/av/collectionReview.tsindex 0362b46508..7e935ebe3d 100644--- a/app/src/protyle/render/av/collectionReview.ts+++ b/app/src/protyle/render/av/collectionReview.ts@@ -28,11 +28,11 @@ export const openCollectionManager = async (protyle: IProtyle, avID: string, blo};const tab = (attribute: string, value: string, label: string) => `<div class="item item--full" ${attribute}="${value}" role="tab" tabindex="0" aria-selected="false"><span class="fn__flex-1"></span><span class="item__text">${escapeHtml(label)}</span><span class="fn__flex-1"></span></div>`;const dialog = new Dialog({title: lang.automationCollectionManage, width: isMobile() ? "92vw" : "760px",- content: `<div class="b3-dialog__content av__collection-preview av__collection-manager">-<div class="layout-tab-bar fn__flex" role="tablist" aria-label="${escapeAttr(lang.automationCollectionManage)}">${tab("data-collection-view", "rules", lang.automationCollectionRules)}${tab("data-collection-view", "entries", lang.automationCollectionEntries)}</div>+ content: `<div class="layout-tab-bar fn__flex av__collection-tabs" role="tablist" aria-label="${escapeAttr(lang.automationCollectionManage)}">${tab("data-collection-view", "rules", lang.automationCollectionRules)}${tab("data-collection-view", "entries", lang.automationCollectionEntries)}</div>+<div class="b3-dialog__content av__collection-preview av__collection-manager"><label class="av__automation-control fn__none" data-rule-control><span>${lang.automationRule}</span><select class="b3-select fn__block" data-collection-rule></select></label><div class="ft__on-surface ft__smaller av__automation-tip" data-review-tip>${lang.automationCollectionReviewTip}</div>-<div class="layout-tab-bar fn__flex" role="tablist" aria-label="${escapeAttr(lang.automationCollectionEntries)}" data-status-tabs>${Object.entries(statuses).map(([value, label]) => tab("data-collection-status", value, label)).join("")}</div>+<div class="layout-tab-bar fn__flex av__collection-tabs" role="tablist" aria-label="${escapeAttr(lang.automationCollectionEntries)}" data-status-tabs>${Object.entries(statuses).map(([value, label]) => tab("data-collection-status", value, label)).join("")}</div><div class="av__automation-preview-results" data-results role="status" aria-live="polite"></div></div><div class="b3-dialog__action av__automation-row"><div class="av__automation-row"><button type="button" class="b3-button b3-button--cancel" data-prev>${lang.previous}</button><span data-page></span><button type="button" class="b3-button b3-button--cancel" data-next>${lang.next}</button></div><span class="fn__flex-1"></span><button type="button" class="b3-button b3-button--text b3-button--wrap fn__none" data-collect>${lang.automationCollectPage}</button><button type="button" class="b3-button b3-button--remove b3-button--wrap" data-cleanup>${lang.automationCollectionCleanup}</button></div>`});const root = dialog.element;diff --git a/app/tests/automationPanel.test.js b/app/tests/automationPanel.test.jsindex efd61229cc..85e3c26ebe 100644--- a/app/tests/automationPanel.test.js+++ b/app/tests/automationPanel.test.js@@ -721,6 +721,15 @@ const runCases = async (sources, css, mobile) => {assert.equal(window.siyuan.dialogs.length, 1, "collection review uses the shared dialog on desktop and mobile");const reviewDialog = window.siyuan.dialogs[0];await waitForDialogLayout(reviewDialog);+ const reviewBody = reviewDialog.element.querySelector(".b3-dialog__body");+ const reviewContent = reviewDialog.element.querySelector(".av__collection-manager");+ const reviewTabs = reviewDialog.element.querySelector("[data-collection-view]").parentElement;+ assert.equal(reviewTabs.parentElement, reviewBody, "view navigation sits above the padded scrolling content");+ reviewTabs.style.setProperty("--b3-ui-tab-min-height", "35px");+ await Promise.all(reviewTabs.firstElementChild.getAnimations().map(animation => animation.finished));+ assert.equal(getComputedStyle(reviewTabs.firstElementChild).minHeight, "35px", "view tabs respect shared tab sizing");+ reviewTabs.style.removeProperty("--b3-ui-tab-min-height");+ await Promise.all(reviewTabs.firstElementChild.getAnimations().map(animation => animation.finished));assert.equal(reviewDialog.element.querySelectorAll("[data-results] img").length, 0, "source text is escaped");assert.equal(transactions.length, writesBeforeReview, "reviewing entries does not mutate the database");const reviewTheme = document.createElement("style");@@ -733,12 +742,20 @@ const runCases = async (sources, css, mobile) => {reviewTheme.textContent = sources[name];await tick();await require("electron").ipcRenderer.invoke("automation-capture", `${mobile ? "mobile" : "desktop"}-${width}-${name}-review`);- for (const element of reviewDialog.element.querySelectorAll(".b3-dialog__body, .b3-dialog__action, [data-results], button")) {+ for (const element of reviewDialog.element.querySelectorAll(".b3-dialog__body, .b3-dialog__action, .av__collection-tabs, .item__text, [data-results], button")) {assert.ok(element.scrollWidth <= element.clientWidth + 1,`${mobile}/${width}/${fontSize}: review content overflows ${element.className}: ${element.scrollWidth}/${element.clientWidth}`);const rect = element.getBoundingClientRect();assert.ok(rect.left >= -1 && rect.right <= window.innerWidth + 1, "review controls stay within the viewport");}+ const tabsRect = reviewTabs.getBoundingClientRect();+ const bodyRect = reviewBody.getBoundingClientRect();+ assert.ok(Math.abs(tabsRect.left - bodyRect.left) < 1 && Math.abs(tabsRect.right - bodyRect.right) < 1,+ "view navigation spans the dialog without a padded inset");+ reviewContent.scrollTop = reviewContent.scrollHeight;+ assert.equal(reviewTabs.getBoundingClientRect().top, tabsRect.top, "scrolling results keeps view navigation in place");+ assert.equal(reviewBody.scrollTop, 0, "content scrolling does not scroll the dialog body");+ reviewContent.scrollTop = 0;const previous = reviewDialog.element.querySelector("[data-prev]").getBoundingClientRect();const cleanup = reviewDialog.element.querySelector("[data-cleanup]").getBoundingClientRect();if (cleanup.top > previous.bottom) {