Browse Source

:art: fix https://github.com/siyuan-note/siyuan/issues/8745

Vanessa 2 years ago
parent
commit
2ffc64a500
2 changed files with 4 additions and 2 deletions
  1. 2 1
      app/src/protyle/util/onGet.ts
  2. 2 1
      app/src/protyle/wysiwyg/index.ts

+ 2 - 1
app/src/protyle/util/onGet.ts

@@ -323,7 +323,8 @@ export const enableProtyle = (protyle: IProtyle) => {
         return;
         return;
     }
     }
     protyle.disabled = false;
     protyle.disabled = false;
-    if (navigator && navigator.maxTouchPoints > 1 && ["MacIntel", "iPhone"].includes(navigator.platform)) {
+    if (isMobile()) {
+        // Android 端空块输入法弹出会收起 https://ld246.com/article/1689713888289
         // iPhone,iPad 端 protyle.wysiwyg.element contenteditable 为 true 时,输入会在块中间插入 span 导致保存失败 https://ld246.com/article/1643473862873/comment/1643813765839#comments
         // iPhone,iPad 端 protyle.wysiwyg.element contenteditable 为 true 时,输入会在块中间插入 span 导致保存失败 https://ld246.com/article/1643473862873/comment/1643813765839#comments
     } else {
     } else {
         protyle.wysiwyg.element.setAttribute("contenteditable", "true");
         protyle.wysiwyg.element.setAttribute("contenteditable", "true");

+ 2 - 1
app/src/protyle/wysiwyg/index.ts

@@ -87,8 +87,9 @@ export class WYSIWYG {
         this.element = document.createElement("div");
         this.element = document.createElement("div");
         this.element.className = "protyle-wysiwyg";
         this.element.className = "protyle-wysiwyg";
         this.element.setAttribute("spellcheck", "false");
         this.element.setAttribute("spellcheck", "false");
-        if (navigator && navigator.maxTouchPoints > 1 && navigator.platform === "MacIntel") {
+        if (isMobile()) {
             // iPhone,iPad 端输入 contenteditable 为 true 时会在块中间插入 span
             // iPhone,iPad 端输入 contenteditable 为 true 时会在块中间插入 span
+            // Android 端空块输入法弹出会收起 https://ld246.com/article/1689713888289
             this.element.setAttribute("contenteditable", "false");
             this.element.setAttribute("contenteditable", "false");
         } else {
         } else {
             this.element.setAttribute("contenteditable", "true");
             this.element.setAttribute("contenteditable", "true");