Browse Source

:iphone: fix https://github.com/siyuan-note/siyuan/issues/6328

Vanessa 2 years ago
parent
commit
60024c65f5
2 changed files with 21 additions and 13 deletions
  1. 8 13
      app/src/assets/scss/_protyle.scss
  2. 13 0
      app/src/protyle/header/Background.ts

+ 8 - 13
app/src/assets/scss/_protyle.scss

@@ -219,15 +219,18 @@
       opacity: 1;
       opacity: 1;
     }
     }
 
 
-    .protyle-background__img:hover .protyle-icons {
+    .protyle-background__img:hover .protyle-icons,
+    &:hover > .protyle-background__iconw > .protyle-icons,
+    .protyle-background__icon:hover {
       opacity: .86;
       opacity: .86;
     }
     }
+  }
 
 
-    &:hover > .protyle-background__iconw > .protyle-icons {
-      opacity: .86;
-    }
 
 
-    .protyle-background__icon:hover {
+  &--mobileshow {
+    .protyle-background__iconw > .protyle-icons,
+    .protyle-background__img .protyle-icons,
+    .protyle-background__tags .item svg {
       opacity: .86;
       opacity: .86;
     }
     }
   }
   }
@@ -464,12 +467,4 @@
       }
       }
     }
     }
   }
   }
-
-  .protyle-background--enable {
-    .protyle-background__iconw > .protyle-icons,
-    .protyle-background__img .protyle-icons,
-    .protyle-background__tags .item svg {
-      opacity: .86;
-    }
-  }
 }
 }

+ 13 - 0
app/src/protyle/header/Background.ts

@@ -336,6 +336,19 @@ export class Background {
                 target = target.parentElement;
                 target = target.parentElement;
             }
             }
         });
         });
+        this.element.addEventListener("touchstart", (event) => {
+            // https://github.com/siyuan-note/siyuan/issues/6328
+            if (protyle.disabled) {
+                return;
+            }
+            const target = event.target as HTMLElement;
+            if (hasClosestByClassName(target, "protyle-icons") ||
+                hasClosestByClassName(target, "item") ||
+                target.classList.contains("protyle-background__icon")) {
+                return;
+            }
+            this.element.classList.toggle("protyle-background--mobileshow");
+        });
     }
     }
 
 
     public render(ial: IObject, rootId: string) {
     public render(ial: IObject, rootId: string) {