mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-24 02:20:13 +01:00
This commit is contained in:
parent
00e883d393
commit
14a874ae9e
2 changed files with 92 additions and 38 deletions
|
|
@ -275,43 +275,43 @@ 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: IOperationSrcs[] = [];
|
||||
const sourceIds: string[] = [];
|
||||
rowElements.forEach(item => {
|
||||
const rowId = item.getAttribute("data-id");
|
||||
const blockValue = genCellValueByElement("block", item.querySelector(".av__cell[data-block-id]"));
|
||||
srcs.push({
|
||||
content: blockValue.block.content,
|
||||
id: rowId,
|
||||
isDetached: blockValue.isDetached,
|
||||
});
|
||||
sourceIds.push(rowId);
|
||||
});
|
||||
const avID = listItemElement.dataset.avId;
|
||||
transaction(protyle, [{
|
||||
action: "insertAttrViewBlock",
|
||||
avID,
|
||||
ignoreFillFilter: true,
|
||||
srcs,
|
||||
blockID: listItemElement.dataset.blockId
|
||||
}, {
|
||||
action: "doUpdateUpdated",
|
||||
id: listItemElement.dataset.blockId,
|
||||
data: dayjs().format("YYYYMMDDHHmmss"),
|
||||
}], [{
|
||||
action: "removeAttrViewBlock",
|
||||
srcIDs: sourceIds,
|
||||
avID,
|
||||
}]);
|
||||
});
|
||||
}
|
||||
});
|
||||
if (!protyle.disabled) {
|
||||
menu.addItem({
|
||||
label: window.siyuan.languages.addToDatabase,
|
||||
icon: "iconDatabase",
|
||||
click() {
|
||||
openSearchAV(blockElement.getAttribute("data-av-id"), rowElements[0] as HTMLElement, (listItemElement) => {
|
||||
const srcs: IOperationSrcs[] = [];
|
||||
const sourceIds: string[] = [];
|
||||
rowElements.forEach(item => {
|
||||
const rowId = item.getAttribute("data-id");
|
||||
const blockValue = genCellValueByElement("block", item.querySelector(".av__cell[data-block-id]"));
|
||||
srcs.push({
|
||||
content: blockValue.block.content,
|
||||
id: rowId,
|
||||
isDetached: blockValue.isDetached,
|
||||
});
|
||||
sourceIds.push(rowId);
|
||||
});
|
||||
const avID = listItemElement.dataset.avId;
|
||||
transaction(protyle, [{
|
||||
action: "insertAttrViewBlock",
|
||||
avID,
|
||||
ignoreFillFilter: true,
|
||||
srcs,
|
||||
blockID: listItemElement.dataset.blockId
|
||||
}, {
|
||||
action: "doUpdateUpdated",
|
||||
id: listItemElement.dataset.blockId,
|
||||
data: dayjs().format("YYYYMMDDHHmmss"),
|
||||
}], [{
|
||||
action: "removeAttrViewBlock",
|
||||
srcIDs: sourceIds,
|
||||
avID,
|
||||
}]);
|
||||
});
|
||||
}
|
||||
});
|
||||
if (rowElements.length === 1) {
|
||||
if (keyCellElement.getAttribute("data-detached") !== "true") {
|
||||
menu.addSeparator();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue