This commit is contained in:
parent
68549c5c81
commit
3cf9d0542f
2 changed files with 34 additions and 27 deletions
|
@ -264,32 +264,6 @@ 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",
|
||||
|
@ -298,6 +272,38 @@ export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement, positi
|
|||
}
|
||||
});
|
||||
}
|
||||
menu.addItem({
|
||||
label: window.siyuan.languages.addToDatabase,
|
||||
icon: "iconDatabase",
|
||||
click() {
|
||||
openSearchAV(blockElement.getAttribute("data-av-id"), rowElements[0] as HTMLElement, (listItemElement) => {
|
||||
const srcs: { id: string, content: string }[] = [];
|
||||
rowElements.forEach(item => {
|
||||
srcs.push({
|
||||
content: item.querySelector(".av__cell[data-block-id] .av__celltext").textContent.trim(),
|
||||
id: item.getAttribute("data-id")
|
||||
});
|
||||
})
|
||||
const avID = listItemElement.dataset.avId;
|
||||
transaction(protyle, [{
|
||||
action: "insertAttrViewBlock",
|
||||
avID,
|
||||
ignoreFillFilter: true,
|
||||
srcs,
|
||||
isDetached: false,
|
||||
blockID: listItemElement.dataset.nodeId
|
||||
}, {
|
||||
action: "doUpdateUpdated",
|
||||
id: listItemElement.dataset.nodeId,
|
||||
data: dayjs().format("YYYYMMDDHHmmss"),
|
||||
}], [{
|
||||
action: "removeAttrViewBlock",
|
||||
srcIDs: sourceIds,
|
||||
avID,
|
||||
}]);
|
||||
});
|
||||
}
|
||||
});
|
||||
if (!protyle.disabled) {
|
||||
if (rowElements.length === 1) {
|
||||
if (keyCellElement.getAttribute("data-detached") !== "true") {
|
||||
|
|
3
app/src/types/index.d.ts
vendored
3
app/src/types/index.d.ts
vendored
|
@ -479,7 +479,8 @@ interface IOperation {
|
|||
nextID?: string // insert 专享
|
||||
isDetached?: boolean // insertAttrViewBlock 专享
|
||||
ignoreFillFilter?: boolean // insertAttrViewBlock 专享
|
||||
srcIDs?: string[] // insertAttrViewBlock 专享
|
||||
srcIDs?: string[] // removeAttrViewBlock 专享
|
||||
srcs?: { id: string, content: string }[] // insertAttrViewBlock 专享
|
||||
name?: string // addAttrViewCol 专享
|
||||
type?: TAVCol // addAttrViewCol 专享
|
||||
deckID?: string // add/removeFlashcards 专享
|
||||
|
|
Loading…
Add table
Reference in a new issue