An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: Keep summary actions on the same row https://github.com/siyuan-note/siyuan/issues/20065
Danielea5e635e9d9e
diff --git a/app/src/assets/scss/protyle/_mindmap-view.scss b/app/src/assets/scss/protyle/_mindmap-view.scssindex e92eb28ce5..f11d5f05da 100644--- a/app/src/assets/scss/protyle/_mindmap-view.scss+++ b/app/src/assets/scss/protyle/_mindmap-view.scss@@ -229,14 +229,17 @@gap: 8px;> span {- flex: 1 1 120px;+ flex: 1 1 auto;min-width: 0;overflow-wrap: anywhere;}+ }- > button {- flex-shrink: 0;- }+ &__summary-actions {+ display: flex;+ flex-shrink: 0;+ gap: 8px;+ margin-left: auto;}&__viewport--pan {diff --git a/app/src/protyle/render/listMindmap/model.test.ts b/app/src/protyle/render/listMindmap/model.test.tsindex bb3ddb1d5d..9cf2fb7f28 100644--- a/app/src/protyle/render/listMindmap/model.test.ts+++ b/app/src/protyle/render/listMindmap/model.test.ts@@ -3529,8 +3529,11 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,document.body.append(batchHost);const batchHistory: {before: string, after: string}[] = [];let batchID = 0;+ const batchLabels: Record<string, string> = {+ listMindmapSummaryBatch: "创建 ${count} 个概要", confirm: "确定", cancel: "取消",+ };const batchView = new api.ListMindmapView({host: batchHost, model: api.readListMindmap(batchList), onExit: () => {},- labels: new Proxy({}, {get: (_target, key) => String(key)}),+ labels: new Proxy(batchLabels, {get: (target, key) => target[String(key)] || String(key)}),onSummaryBatchAdd: async (ranges: any[], expected: string) => {const model = api.readListMindmap(batchList);check.equal(api.getListMindmapSummarySnapshot(model), expected);@@ -3561,11 +3564,29 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,check.equal(batchView.summaryRanges.length, 2);check.equal(batchHistory.length, 0, "dragging only previews the groups");check.equal(batchHost.querySelector<HTMLElement>(".mindmap-view__summary-controls").hidden, false);+ const controls = batchHost.querySelector<HTMLElement>(".mindmap-view__summary-controls");+ const actions = [...controls.querySelectorAll("button")];+ const checkButtonRow = () => {+ check.equal(actions[0].getBoundingClientRect().top, actions[1].getBoundingClientRect().top,+ "cancel and confirm stay on one row");+ };+ checkButtonRow();+ const countBounds = controls.querySelector("span").getBoundingClientRect();+ const actionBounds = actions[0].getBoundingClientRect();+ check.ok(Math.abs(countBounds.top + countBounds.height / 2 - actionBounds.top - actionBounds.height / 2) < 1,+ "compact localized labels do not force actions onto a separate row");+ check.equal(actions[0].textContent, batchLabels.cancel);+ check.equal(actions[1].textContent, batchLabels.confirm);+ actions[0].focus();+ const cancelKey = new KeyboardEvent("keydown", {key: "Enter", bubbles: true, cancelable: true});+ actions[0].dispatchEvent(cancelKey);+ check.equal(cancelKey.defaultPrevented, false, "focused cancel keeps native keyboard activation");+ check.equal(batchHistory.length, 0, "Enter on cancel never confirms the batch");batchHost.style.width = "280px";batchHost.style.fontSize = "32px";await settle();- const controls = batchHost.querySelector<HTMLElement>(".mindmap-view__summary-controls");const controlsBounds = controls.getBoundingClientRect();+ checkButtonRow();check.ok(controlsBounds.width <= batchHost.offsetWidth - 16);controls.querySelectorAll("button").forEach(button => {const rect = button.getBoundingClientRect();diff --git a/app/src/protyle/render/listMindmap/view.ts b/app/src/protyle/render/listMindmap/view.tsindex 1e5925af78..0fa98139df 100644--- a/app/src/protyle/render/listMindmap/view.ts+++ b/app/src/protyle/render/listMindmap/view.ts@@ -229,7 +229,9 @@ export class ListMindmapView {this.cancelSummarySelection();this.updateSelection();});- this.summaryControls.append(this.summaryCount, this.summaryConfirm, cancelSummary);+ const summaryActions = createElement("div", "mindmap-view__summary-actions");+ summaryActions.append(cancelSummary, this.summaryConfirm);+ this.summaryControls.append(this.summaryCount, summaryActions);options.host.append(this.summaryControls);this.summaryBox.hidden = true;this.viewport.append(this.summaryBox);@@ -2863,6 +2865,9 @@ export class ListMindmapView {this.viewport.contains(target.closest(".mindmap-view__node--editing"))) {return;}+ if (this.summaryControls.contains(target) && target.closest("button") && event.key !== "Escape") {+ return;+ }if (this.pointer?.relation && event.key !== "Escape") {return;}