🎨 为文档增加添加到数据库操作
This commit is contained in:
parent
83df1111e2
commit
bffd71dd67
1 changed files with 22 additions and 0 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue