An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Support cross-document undo https://github.com/siyuan-note/siyuan/issues/4866
Daniel5eb994e7bdab
diff --git a/app/src/protyle/undo/globalUndo.ts b/app/src/protyle/undo/globalUndo.tsindex 11a53d0017..687fc59644 100644--- a/app/src/protyle/undo/globalUndo.ts+++ b/app/src/protyle/undo/globalUndo.ts@@ -165,12 +165,21 @@ export const requestUndo = async (protyle: IProtyle) => {if (peekMutatedRootIDs.length > 1) {const names = await resolveRootNames(peekMutatedRootIDs);+ // 确认期间拦截当前编辑器的键盘输入(遮罩只挡鼠标点击,不挡键盘冒泡)+ const blockInput = (e: Event) => {+ e.stopImmediatePropagation();+ e.preventDefault();+ };+ protyle.wysiwyg.element.addEventListener("keydown", blockInput, true);+ protyle.wysiwyg.element.addEventListener("beforeinput", blockInput, true);const confirmed = await new Promise<boolean>((resolve) => {confirmDialog(`⚠️ ${window.siyuan.languages.undo}`,`${window.siyuan.languages.undoCrossDocConfirm}<br>${names.join(" / ")}`,() => resolve(true),() => resolve(false));});+ protyle.wysiwyg.element.removeEventListener("keydown", blockInput, true);+ protyle.wysiwyg.element.removeEventListener("beforeinput", blockInput, true);if (!confirmed) {isUndoing = false; // 拒绝,复位锁,栈与镜像不动return;