From fc85a72a1be11319223da72eaa8fd7f3e19c0433 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 31 Oct 2022 15:52:01 +0800 Subject: [PATCH] :bug: fix https://github.com/siyuan-note/siyuan/issues/6421 --- app/src/protyle/util/editorCommonEvent.ts | 4 ++-- app/src/protyle/wysiwyg/index.ts | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/protyle/util/editorCommonEvent.ts b/app/src/protyle/util/editorCommonEvent.ts index 3e812aa5e..c62fe25ef 100644 --- a/app/src/protyle/util/editorCommonEvent.ts +++ b/app/src/protyle/util/editorCommonEvent.ts @@ -575,8 +575,8 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => { document.onmouseup = null; }); editorElement.addEventListener("drop", async (event: DragEvent & { target: HTMLElement }) => { - if (event.dataTransfer.getData(Constants.SIYUAN_DROP_EDITOR)) { - // 编辑器内选中文字拖拽 + if (protyle.disabled || event.dataTransfer.getData(Constants.SIYUAN_DROP_EDITOR)) { + // 只读模式/编辑器内选中文字拖拽 event.preventDefault(); event.stopPropagation(); return; diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index 68bf8322c..fa5f51239 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -1267,6 +1267,11 @@ export class WYSIWYG { }); this.element.addEventListener("paste", (event: ClipboardEvent & { target: HTMLElement }) => { + if (protyle.disabled) { + event.stopPropagation(); + event.preventDefault(); + return; + } window.siyuan.ctrlIsPressed = false; // https://github.com/siyuan-note/siyuan/issues/6373 // https://github.com/siyuan-note/siyuan/issues/4600 if (event.target.tagName === "PROTYLE-HTML") {