Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: fix https://github.com/siyuan-note/siyuan/issues/10929

Vanessa541483ed2900
diff --git a/app/src/protyle/render/av/action.ts b/app/src/protyle/render/av/action.ts
index c5cdd95eff..073614c62f 100644
--- a/app/src/protyle/render/av/action.ts
+++ b/app/src/protyle/render/av/action.ts
@@ -34,6 +34,7 @@ import {openCalcMenu} from "./calc";
import {avRender} from "./render";
import {addView, openViewMenu} from "./view";
import {isOnlyMeta, openByMobile, writeText} from "../../util/compatibility";
+import {openSearchAV} from "./relation";
export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLElement }) => {
const blockElement = hasClosestBlock(event.target);
@@ -314,6 +315,32 @@ export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement, positi
type: "submenu",
submenu: copySubMenu(blockId)
});
+ menu.addItem({
+ label: window.siyuan.languages.addToDatabase,
+ icon: "iconDatabase",
+ click() {
+ openSearchAV(blockElement.getAttribute("data-av-id"), rowElements[0] as HTMLElement, (listItemElement) => {
+ const sourceIds: string[] = [blockId];
+ const avID = listItemElement.dataset.avId;
+ transaction(protyle, [{
+ action: "insertAttrViewBlock",
+ avID,
+ ignoreFillFilter: true,
+ srcIDs: sourceIds,
+ isDetached: false,
+ blockID: listItemElement.dataset.nodeId
+ }, {
+ action: "doUpdateUpdated",
+ id: listItemElement.dataset.nodeId,
+ data: dayjs().format("YYYYMMDDHHmmss"),
+ }], [{
+ action: "removeAttrViewBlock",
+ srcIDs: sourceIds,
+ avID,
+ }]);
+ });
+ }
+ });
menu.addItem({
label: window.siyuan.languages.unbindBlock,
icon: "iconLinkOff",