Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/8554 14

Vanessae2c11fa5903b
diff --git a/app/src/protyle/wysiwyg/remove.ts b/app/src/protyle/wysiwyg/remove.ts
index 9296ee317f..92956a74c1 100644
--- a/app/src/protyle/wysiwyg/remove.ts
+++ b/app/src/protyle/wysiwyg/remove.ts
@@ -5,6 +5,7 @@ import {
focusByWbr,
getBlockRanges,
getSelectionOffset,
+ getUndoFocusContext,
setLastNodeRange
} from "../util/selection";
import {
@@ -106,6 +107,10 @@ export const removeCrossBlockRange = (protyle: IProtyle, selectedRange: Range,
return;
}
+ const undoFocusContext = getUndoFocusContext(editorElement, selectedRange, true);
+ if (undoFocusContext) {
+ undoFocusContext.undoFocusCollapseToEnd = "true";
+ }
const undoOperations: IOperation[] = updateElements.map(item => ({
action: "update",
id: item.getAttribute("data-node-id"),
@@ -202,7 +207,11 @@ export const removeCrossBlockRange = (protyle: IProtyle, selectedRange: Range,
data: item.outerHTML
});
});
- transaction(protyle, doOperations, undoOperations.concat(insertOperations));
+ const crossBlockUndoOperations = undoOperations.concat(insertOperations);
+ if (crossBlockUndoOperations[0]) {
+ crossBlockUndoOperations[0].context = undoFocusContext;
+ }
+ transaction(protyle, doOperations, crossBlockUndoOperations);
const firstRange = ranges.find(item => item.editableElement.isConnected);
if (firstRange) {