From bffd71dd67e6843ee4ce92055d6eed7aa310f3ec Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 19 Feb 2024 16:38:20 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E4=B8=BA=E6=96=87=E6=A1=A3=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=B7=BB=E5=8A=A0=E5=88=B0=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/protyle/header/openTitleMenu.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/app/src/protyle/header/openTitleMenu.ts b/app/src/protyle/header/openTitleMenu.ts index d7ff42994..0a22e8aa6 100644 --- a/app/src/protyle/header/openTitleMenu.ts +++ b/app/src/protyle/header/openTitleMenu.ts @@ -27,6 +27,8 @@ import {openDocHistory} from "../../history/doc"; import {openNewWindowById} from "../../window/openNewWindow"; import {genImportMenu} from "../../menus/navigation"; import {transferBlockRef} from "../../menus/block"; +import {openSearchAV} from "../render/av/relation"; +import {transaction} from "../wysiwyg/transaction"; export const openTitleMenu = (protyle: IProtyle, position: IPosition) => { hideTooltip(); @@ -48,6 +50,26 @@ export const openTitleMenu = (protyle: IProtyle, position: IPosition) => { }).element); if (!protyle.disabled) { window.siyuan.menus.menu.append(movePathToMenu([protyle.path])); + window.siyuan.menus.menu.append(new MenuItem({ + label: window.siyuan.languages.addToDatabase, + icon: "iconDatabase", + click: () => { + openSearchAV("", protyle.breadcrumb.element, (listItemElement) => { + const sourceIds: string[] = [response.data.rootID]; + const avID = listItemElement.dataset.avId; + transaction(protyle, [{ + action: "insertAttrViewBlock", + avID, + srcIDs: sourceIds, + isDetached: false, + }], [{ + action: "removeAttrViewBlock", + srcIDs: sourceIds, + avID, + }]); + }); + } + }).element); window.siyuan.menus.menu.append(new MenuItem({ icon: "iconTrashcan", label: window.siyuan.languages.delete,