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: https://github.com/siyuan-note/siyuan/issues/9958
Vanessa492621e131ef
diff --git a/app/src/protyle/render/av/openMenuPanel.ts b/app/src/protyle/render/av/openMenuPanel.tsindex 71411c90bd..e80627b540 100644--- a/app/src/protyle/render/av/openMenuPanel.ts+++ b/app/src/protyle/render/av/openMenuPanel.ts@@ -765,7 +765,12 @@ export const openMenuPanel = (options: {event.stopPropagation();break;} else if (type === "goSearchRollupCol") {- goSearchRollupCol(avID, target);+ goSearchRollupCol({+ target,+ data,+ protyle: options.protyle,+ colId: menuElement.querySelector(".b3-menu__item").getAttribute("data-col-id")+ });event.preventDefault();event.stopPropagation();break;diff --git a/app/src/protyle/render/av/rollup.ts b/app/src/protyle/render/av/rollup.tsindex d30377903f..1b57ea3332 100644--- a/app/src/protyle/render/av/rollup.ts+++ b/app/src/protyle/render/av/rollup.ts@@ -4,27 +4,44 @@ import {upDownHint} from "../../../util/upDownHint";import {fetchPost} from "../../../util/fetch";import {escapeHtml} from "../../../util/escape";import {transaction} from "../../wysiwyg/transaction";-import {updateCellsValue} from "./cell";-import {updateAttrViewCellAnimation} from "./action";-import {focusBlock} from "../../util/selection";+import {genIconHTML} from "../util";+import {unicode2Emoji} from "../../../emoji";+import {getColIconByType} from "./col";++const updateCol = (protyle: IProtyle, data: IAV, colId: string, itemElement: HTMLElement) => {+ const colData = data.view.columns.find((item) => {+ if (item.id === colId) {+ return true;+ }+ })+ transaction(protyle, [{+ action: "updateAttrViewColRollup",+ id: colId,+ avID: data.id,+ parentID: itemElement.dataset.colId,+ // keyID: "",+ // data: "",+ }], [{+ action: "updateAttrViewColRollup",+ // operation.AvID 汇总列所在 av+ // operation.ID 汇总列 ID+ // operation.ParentID 汇总列基于的关联列 ID+ // operation.KeyID 目标列 ID+ // operation.Data 计算方式+ }])+}const genSearchList = (element: Element, keyword: string, avId: string, cb?: () => void) => {- fetchPost("/api/av/searchAttributeViewNonRelationKey", {keyword}, (response) => {+ fetchPost("/api/av/searchAttributeViewNonRelationKey", {+ avID: avId,+ keyword+ }, (response) => {let html = "";- response.data.results.forEach((item: {- avID: string- avName: string- blockID: string- hPath: string- }, index: number) => {- html += `<div class="b3-list-item b3-list-item--narrow${index === 0 ? " b3-list-item--focus" : ""}" data-av-id="${item.avID}" data-block-id="${item.blockID}">- <div class="b3-list-item--two fn__flex-1">- <div class="b3-list-item__first">- <span class="b3-list-item__text">${escapeHtml(item.avName || window.siyuan.languages.title)}</span>- </div>- <div class="b3-list-item__meta b3-list-item__showall">${escapeHtml(item.hPath)}</div>- </div>- <svg aria-label="${window.siyuan.languages.thisDatabase}" style="margin: 0 0 0 4px" class="b3-list-item__hinticon ariaLabel${item.avID === avId ? "" : " fn__none"}"><use xlink:href="#iconInfo"></use></svg>+ response.data.nonRelationKeys.forEach((item: IAVColumn, index: number) => {+ html += `<div class="b3-list-item b3-list-item--narrow${index === 0 ? " b3-list-item--focus" : ""}" data-col-id="${item.id}">+ ${item.icon ? unicode2Emoji(item.icon, "b3-list-item__graphic", true) : `<svg class="b3-list-item__graphic"><use xlink:href="#${getColIconByType(item.type)}"></use></svg>`}+ ${genIconHTML()}+ <span class="b3-list-item__text">${escapeHtml(item.name || window.siyuan.languages.title)}</span></div>`;});element.innerHTML = html;@@ -34,7 +51,12 @@ const genSearchList = (element: Element, keyword: string, avId: string, cb?: ()});};-export const goSearchRollupCol = (avId: string, target: HTMLElement) => {+export const goSearchRollupCol = (options: {+ target: HTMLElement,+ data: IAV,+ protyle: IProtyle,+ colId: string+}) => {window.siyuan.menus.menu.remove();const menu = new Menu();menu.addItem({@@ -61,24 +83,24 @@ export const goSearchRollupCol = (avId: string, target: HTMLElement) => {if (event.key === "Enter") {event.preventDefault();event.stopPropagation();- // setDatabase(avId, target, listElement.querySelector(".b3-list-item--focus"));+ updateCol(options.protyle, options.data, options.colId, listElement.querySelector(".b3-list-item--focus"));window.siyuan.menus.menu.remove();}});inputElement.addEventListener("input", (event) => {event.stopPropagation();- genSearchList(listElement, inputElement.value, avId);+ genSearchList(listElement, inputElement.value, options.data.id);});element.lastElementChild.addEventListener("click", (event) => {const listItemElement = hasClosestByClassName(event.target as HTMLElement, "b3-list-item");if (listItemElement) {event.stopPropagation();- // setDatabase(avId, target, listItemElement);+ updateCol(options.protyle, options.data, options.colId, listItemElement);window.siyuan.menus.menu.remove();}});- genSearchList(listElement, "", avId, () => {- const rect = target.getBoundingClientRect();+ genSearchList(listElement, "", options.data.id, () => {+ const rect = options.target.getBoundingClientRect();menu.open({x: rect.left,y: rect.bottom,diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.tsindex 8c1ac0fd10..f9ccf52ab6 100644--- a/app/src/protyle/wysiwyg/transaction.ts+++ b/app/src/protyle/wysiwyg/transaction.ts@@ -724,7 +724,7 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo:"setAttrViewSorts", "setAttrViewColCalc", "removeAttrViewCol", "updateAttrViewColNumberFormat", "removeAttrViewBlock","replaceAttrViewBlock", "updateAttrViewColTemplate", "setAttrViewColPin", "addAttrViewView","removeAttrViewView", "setAttrViewViewName", "setAttrViewViewIcon", "duplicateAttrViewView", "sortAttrViewView",- "updateAttrViewColRelation", "setAttrViewPageSize"].includes(operation.action)) {+ "updateAttrViewColRelation", "setAttrViewPageSize", "updateAttrViewColRollup"].includes(operation.action)) {refreshAV(protyle, operation, isUndo);} else if (operation.action === "doUpdateUpdated") {updateElements.forEach(item => {diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.tsindex 0fca834486..25efb52993 100644--- a/app/src/types/index.d.ts+++ b/app/src/types/index.d.ts@@ -50,6 +50,7 @@ type TOperation =| "sortAttrViewView"| "setAttrViewPageSize"| "updateAttrViewColRelation"+ | "updateAttrViewColRollup"type TBazaarType = "templates" | "icons" | "widgets" | "themes" | "plugins"type TCardType = "doc" | "notebook" | "all"type TEventBus = "ws-main" | "sync-start" | "sync-end" | "sync-fail" |