From 48e62f4e96719f787d4fc84ad9489e4c1bd75fcc Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 15 Aug 2022 17:30:35 +0800 Subject: [PATCH] :bug: fix https://github.com/siyuan-note/siyuan/issues/5637 --- app/src/protyle/wysiwyg/index.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index f941e1aad..fd4429cee 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -35,6 +35,7 @@ import {transaction, updateTransaction} from "./transaction"; import {hideElements} from "../ui/hideElements"; /// #if !BROWSER import {shell} from "electron"; +import {getCurrentWindow} from "@electron/remote"; /// #endif import {removeEmbed} from "./removeEmbed"; import {keydown} from "./keydown"; @@ -1251,9 +1252,16 @@ export class WYSIWYG { this.element.addEventListener("input", (event: InputEvent) => { const target = event.target as HTMLElement; - if (target.tagName === "VIDEO" || target.tagName === "AUDIO") { + if (target.tagName === "VIDEO" || target.tagName === "AUDIO" || event.inputType === "historyRndo") { return; } + /// #if !BROWSER + if (event.inputType === "historyUndo") { + getCurrentWindow().webContents.redo(); + window.siyuan.menus.menu.remove(); + return; + } + /// #endif const range = getEditorRange(this.element); const blockElement = hasClosestBlock(range.startContainer); if (!blockElement) {