An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:lipstick: Refine relation selection controls and compact window layout https://github.com/siyuan-note/siyuan/issues/19904
Daniel076426c96c93
diff --git a/app/src/assets/scss/business/_av.scss b/app/src/assets/scss/business/_av.scssindex 810af0968b..5d557e9e96 100644--- a/app/src/assets/scss/business/_av.scss+++ b/app/src/assets/scss/business/_av.scss@@ -2564,7 +2564,7 @@ img.av__cellassetimg {}.av__relation-fields {- max-height: 180px;+ max-height: min(180px, 30vh);overflow: auto;padding: 8px;}diff --git a/app/src/protyle/render/av/relation.ts b/app/src/protyle/render/av/relation.tsindex f690cfe725..651cabac8e 100644--- a/app/src/protyle/render/av/relation.ts+++ b/app/src/protyle/render/av/relation.ts@@ -25,6 +25,7 @@ import {hasAVRenderTemplateResult} from "./cellValue";import {renderAVRichTextElements} from "./richText";import {getFileTreeIconHTML} from "../../../emoji/fileTreeIcon";import {bindRelationLayout} from "./relationLayout";+import {getTopBarHeight} from "../../../layout/getTopBarHeight";interface IAVItem {avID: string;@@ -535,7 +536,8 @@ export const bindRelationEvent = (options: {return false;}const menuStyle = getComputedStyle(options.menuElement);- const maxMenuHeight = parseFloat(menuStyle.maxHeight) || window.innerHeight - 32;+ const maxMenuHeight = Math.min(parseFloat(menuStyle.maxHeight) || window.innerHeight - 32,+ window.innerHeight - getTopBarHeight() - 8);const headerHeight = listElement.previousElementSibling?.getBoundingClientRect().height || 0;const chromeHeight = headerHeight + parseFloat(menuStyle.paddingTop) + parseFloat(menuStyle.paddingBottom) +parseFloat(menuStyle.borderTopWidth) + parseFloat(menuStyle.borderBottomWidth);@@ -901,7 +903,7 @@ export const getRelationHTML = (data: IAV, cellElements?: HTMLElement[]) => {<span class="fn__space"></span><span style="color: var(--b3-protyle-inline-blockref-color);max-width: 200px" data-id="" class="popover__block fn__pointer fn__ellipsis"></span><span class="fn__space"></span>- <button type="button" class="block__icon" data-type="relationFields" aria-expanded="false" aria-label="${window.siyuan.languages.fields}"><svg><use xlink:href="#iconSettings"></use></svg></button>+ <button type="button" class="block__icon" data-type="relationFields" aria-expanded="false" aria-label="${window.siyuan.languages.fields}"><svg><use xlink:href="#iconMore"></use></svg></button></div><div class="av__relation-fields fn__none"></div></div>diff --git a/app/src/protyle/render/av/relationLayout.ts b/app/src/protyle/render/av/relationLayout.tsindex 401deb33a3..a4b875fb00 100644--- a/app/src/protyle/render/av/relationLayout.ts+++ b/app/src/protyle/render/av/relationLayout.ts@@ -53,7 +53,11 @@ data-width="${escapeAttr(column.id)}" aria-label="${escapeAttr(column.name + " "onResize();});fields.addEventListener("click", event => event.stopPropagation());- fields.addEventListener("keydown", event => event.stopPropagation());+ fields.addEventListener("keydown", event => {+ if (event.key !== "Escape") {+ event.stopPropagation();+ }+ });fields.addEventListener("change", event => {event.stopPropagation();const input = event.target as HTMLInputElement;diff --git a/app/tests/avRelationTemplate.test.js b/app/tests/avRelationTemplate.test.jsindex 05c777ce02..0caf7c9ddb 100644--- a/app/tests/avRelationTemplate.test.js+++ b/app/tests/avRelationTemplate.test.js@@ -75,6 +75,12 @@ const runCases = sources => {const columns = [{id: "primary", name: "Title"}, {id: "other", name: "Other"}];const update = bindRelationLayout(root, "database", () => {});update(columns, "32px 240px 160px");+ const bubbledKeys = [];+ root.addEventListener("keydown", event => bubbledKeys.push(event.key));+ for (const key of ["ArrowUp", "Escape"]) {+ root.querySelector(".av__relation-fields").dispatchEvent(new KeyboardEvent("keydown", {key, bubbles: true}));+ }+ assert.deepEqual(bubbledKeys, ["Escape"]);root.querySelector("button").click();assert.equal(root.querySelector('[data-column="primary"]').disabled, true);const other = root.querySelector('[data-column="other"]');