From 22ffc30245bc7f4a6ac0a32e16a2946f7edd8a20 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sun, 2 Jul 2023 09:21:55 +0800 Subject: [PATCH] :art: fix https://github.com/siyuan-note/siyuan/issues/8652 --- app/src/dialog/index.ts | 3 ++- app/src/plugin/Setting.ts | 2 +- app/src/protyle/wysiwyg/index.ts | 6 +++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/src/dialog/index.ts b/app/src/dialog/index.ts index acd36cb68..fbcc7bccc 100644 --- a/app/src/dialog/index.ts +++ b/app/src/dialog/index.ts @@ -3,6 +3,7 @@ import {genUUID} from "../util/genID"; import {moveResize} from "./moveResize"; /// #endif import {isMobile} from "../util/functions"; +import {isCtrl} from "../protyle/util/compatibility"; export class Dialog { private destroyCallback: (options?: IObject) => void; @@ -92,7 +93,7 @@ export class Dialog { event.stopPropagation(); return; } - if (event.key === "Enter" && enterEvent) { + if (!event.shiftKey && !isCtrl(event) && event.key === "Enter" && enterEvent) { enterEvent(); event.preventDefault(); } diff --git a/app/src/plugin/Setting.ts b/app/src/plugin/Setting.ts index 407c1f9ec..18f773ea2 100644 --- a/app/src/plugin/Setting.ts +++ b/app/src/plugin/Setting.ts @@ -69,7 +69,7 @@ export class Setting { if (actionElement) { if (["INPUT", "TEXTAREA"].includes(actionElement.tagName)) { dialog.bindInput(actionElement as HTMLInputElement, () => { - (btnsElement[1] as HTMLButtonElement).click(); + btnsElement[1].dispatchEvent(new CustomEvent("click")); }); } if (actionElement.tagName === "TEXTAREA") { diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index 6e3902c73..3f91c213c 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -1395,6 +1395,9 @@ export class WYSIWYG { }); this.element.addEventListener("compositionend", (event: InputEvent) => { + if ((event.target as HTMLElement).classList.contains("av__title")) { + return; + } event.stopPropagation(); isComposition = false; const range = getEditorRange(this.element); @@ -1421,7 +1424,8 @@ export class WYSIWYG { this.element.addEventListener("input", (event: InputEvent) => { const target = event.target as HTMLElement; - if (target.tagName === "VIDEO" || target.tagName === "AUDIO" || event.inputType === "historyRedo") { + if (target.tagName === "VIDEO" || target.tagName === "AUDIO" || event.inputType === "historyRedo" || + target.classList.contains("av__title")) { return; } if (event.inputType === "historyUndo") {