瀏覽代碼

:bug: fix https://github.com/siyuan-note/siyuan/issues/6421

Vanessa 2 年之前
父節點
當前提交
fc85a72a1b
共有 2 個文件被更改,包括 7 次插入2 次删除
  1. 2 2
      app/src/protyle/util/editorCommonEvent.ts
  2. 5 0
      app/src/protyle/wysiwyg/index.ts

+ 2 - 2
app/src/protyle/util/editorCommonEvent.ts

@@ -575,8 +575,8 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
         document.onmouseup = null;
         document.onmouseup = null;
     });
     });
     editorElement.addEventListener("drop", async (event: DragEvent & { target: HTMLElement }) => {
     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.preventDefault();
             event.stopPropagation();
             event.stopPropagation();
             return;
             return;

+ 5 - 0
app/src/protyle/wysiwyg/index.ts

@@ -1267,6 +1267,11 @@ export class WYSIWYG {
         });
         });
 
 
         this.element.addEventListener("paste", (event: ClipboardEvent & { target: HTMLElement }) => {
         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
             window.siyuan.ctrlIsPressed = false; // https://github.com/siyuan-note/siyuan/issues/6373
             // https://github.com/siyuan-note/siyuan/issues/4600
             // https://github.com/siyuan-note/siyuan/issues/4600
             if (event.target.tagName === "PROTYLE-HTML") {
             if (event.target.tagName === "PROTYLE-HTML") {