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/11252
Vanessa86fab2b36add
diff --git a/app/src/protyle/render/av/col.ts b/app/src/protyle/render/av/col.tsindex 0b1bc7acc4..99c8ff0f66 100644--- a/app/src/protyle/render/av/col.ts+++ b/app/src/protyle/render/av/col.ts@@ -1,6 +1,6 @@import {Menu} from "../../../plugin/Menu";import {transaction} from "../../wysiwyg/transaction";-import {fetchPost} from "../../../util/fetch";+import {fetchPost, fetchSyncPost} from "../../../util/fetch";import {getDefaultOperatorByType, setFilter} from "./filter";import {genCellValue} from "./cell";import {getPropertiesHTML, openMenuPanel} from "./openMenuPanel";@@ -14,6 +14,7 @@ import {Constants} from "../../../constants";import * as dayjs from "dayjs";import {setPosition} from "../../../util/setPosition";import {duplicateNameAddOne} from "../../../util/functions";+import {Dialog} from "../../../dialog";export const duplicateCol = (options: {protyle: IProtyle,@@ -845,30 +846,78 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemenmenu.addItem({icon: "iconTrashcan",label: window.siyuan.languages.delete,- click() {- const newUpdated = dayjs().format("YYYYMMDDHHmmss");- transaction(protyle, [{- action: "removeAttrViewCol",- id: colId,- avID,- }, {- action: "doUpdateUpdated",- id: blockID,- data: newUpdated,- }], [{- action: "addAttrViewCol",- name: oldValue,+ async click() {+ if (type === "relation") {+ const response = await fetchSyncPost("/api/av/getAttributeView", {id: avID})+ const colData = response.data.av.keyValues.find((item: {+ key: { id: string }+ }) => item.key.id === colId);+ if (colData.key.relation?.isTwoWay) {+ const relResponse = await fetchSyncPost("/api/av/getAttributeView", {id: colData.key.relation.avID})+ const dialog = new Dialog({+ title: window.siyuan.languages.removeCol.replace("${x}", colData.key.name),+ content: `<div class="b3-dialog__content">+ ${window.siyuan.languages.confirmRemoveRelationField.replace("${x}", relResponse.data.av.name)}+ <div class="fn__hr--b"></div>+ <button class="fn__block b3-button b3-button--error">${window.siyuan.languages.delete}</button>+ <div class="fn__hr"></div>+ <button class="fn__block b3-button b3-button--warning">${window.siyuan.languages.removeButKeepRelationField}</button>+ <div class="fn__hr"></div>+ <button class="fn__block b3-button b3-button--info">${window.siyuan.languages.cancel}</button>+</div>`,+ });+ dialog.element.addEventListener("click", (event) => {+ let target = event.target as HTMLElement;+ while (target && !target.isSameNode(dialog.element)) {+ if (target.classList.contains("b3-button--error")) {+ removeColByMenu({+ protyle,+ colId,+ avID,+ blockID,+ oldValue,+ type,+ cellElement,+ blockElement,+ removeDest: true+ })+ dialog.destroy();+ break;+ } else if (target.classList.contains("b3-button--warning")) {+ removeColByMenu({+ protyle,+ colId,+ avID,+ blockID,+ oldValue,+ type,+ cellElement,+ blockElement,+ removeDest: false+ })+ dialog.destroy();+ break;+ } else if (target.classList.contains("b3-button--info")) {+ dialog.destroy();+ break;+ }+ target = target.parentElement;+ }+ })+ return+ }+ }+ removeColByMenu({+ protyle,+ colId,avID,- type: type,- id: colId,- previousID: cellElement.previousElementSibling?.getAttribute("data-col-id") || "",- }, {- action: "doUpdateUpdated",- id: blockID,- data: blockElement.getAttribute("updated")- }]);- removeAttrViewColAnimation(blockElement, colId);- blockElement.setAttribute("updated", newUpdated);+ blockID,+ oldValue,+ type,+ cellElement,+ blockElement,+ removeDest: false+ })}});menu.addSeparator();@@ -908,6 +957,43 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen}};+const removeColByMenu = (options: {+ protyle: IProtyle,+ colId: string,+ avID: string,+ blockID: string,+ oldValue: string,+ type: TAVCol,+ cellElement: HTMLElement,+ blockElement: Element,+ removeDest: boolean+}) => {+ const newUpdated = dayjs().format("YYYYMMDDHHmmss");+ transaction(options.protyle, [{+ action: "removeAttrViewCol",+ id: options.colId,+ avID: options.avID,+ removeDest: options.removeDest+ }, {+ action: "doUpdateUpdated",+ id: options.blockID,+ data: newUpdated,+ }], [{+ action: "addAttrViewCol",+ name: options.oldValue,+ avID: options.avID,+ type: options.type,+ id: options.colId,+ previousID: options.cellElement.previousElementSibling?.getAttribute("data-col-id") || "",+ }, {+ action: "doUpdateUpdated",+ id: options.blockID,+ data: options.blockElement.getAttribute("updated")+ }]);+ removeAttrViewColAnimation(options.blockElement, options.colId);+ options.blockElement.setAttribute("updated", newUpdated);+}+export const removeCol = (options: {protyle: IProtyle,data: IAV,