mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-24 02:20:13 +01:00
🐛 数据库删除行后 Ctrl+z
This commit is contained in:
parent
cd8d94ae8b
commit
b3bc14d9e0
2 changed files with 16 additions and 9 deletions
|
|
@ -262,21 +262,26 @@ export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement, positi
|
|||
icon: "iconTrashcan",
|
||||
label: window.siyuan.languages.delete,
|
||||
click() {
|
||||
const previousElement = rowElements[0].previousElementSibling as HTMLElement;
|
||||
const avID = blockElement.getAttribute("data-av-id")
|
||||
const undoOperations: IOperation[] = [];
|
||||
rowElements.forEach(item => {
|
||||
undoOperations.push({
|
||||
action: "insertAttrViewBlock",
|
||||
avID,
|
||||
previousID: item.previousElementSibling?.getAttribute("data-id") || "",
|
||||
srcIDs: [item.getAttribute("data-id")],
|
||||
isDetached: item.querySelector('.av__cell[data-detached="true"]') ? true : false,
|
||||
})
|
||||
})
|
||||
transaction(protyle, [{
|
||||
action: "removeAttrViewBlock",
|
||||
srcIDs: blockIds,
|
||||
avID: blockElement.getAttribute("data-av-id"),
|
||||
}], [{
|
||||
action: "insertAttrViewBlock",
|
||||
avID: blockElement.getAttribute("data-av-id"),
|
||||
previousID: previousElement?.getAttribute("data-id") || "",
|
||||
srcIDs: rowIds,
|
||||
}]);
|
||||
avID,
|
||||
}], undoOperations);
|
||||
rowElements.forEach(item => {
|
||||
item.remove();
|
||||
});
|
||||
updateHeader(previousElement);
|
||||
updateHeader(blockElement.querySelector(".av__row"));
|
||||
}
|
||||
});
|
||||
if (rowIds.length === 1) {
|
||||
|
|
|
|||
|
|
@ -877,6 +877,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
avID,
|
||||
previousID,
|
||||
srcIDs: sourceIds,
|
||||
isDetached: false,
|
||||
}], [{
|
||||
action: "removeAttrViewBlock",
|
||||
srcIDs: sourceIds,
|
||||
|
|
@ -934,6 +935,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
avID,
|
||||
previousID,
|
||||
srcIDs: ids,
|
||||
isDetached: false,
|
||||
}], [{
|
||||
action: "removeAttrViewBlock",
|
||||
srcIDs: ids,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue