Bladeren bron

Merge branch 'gesture-support-on-block' of https://github.com/logseq/logseq into gesture-support-on-block

llcc 3 jaren geleden
bovenliggende
commit
b5d781e05f

+ 4 - 2
src/main/frontend/components/block.cljs

@@ -1618,6 +1618,8 @@
                            [(str class " checked") true])]
     (when class
       (ui/checkbox {:class class
+                    :style {:margin-top -2
+                            :margin-right 5}
                     :checked checked?
                     :on-mouse-down (fn [e]
                                      (util/stop-propagation e))
@@ -1718,7 +1720,7 @@
         html-export? (:html-export? config)
         checkbox (when (and (not pre-block?)
                             (not html-export?))
-                   (block-checkbox t "mr-1 cursor"))
+                   (block-checkbox t (str "mr-1 cursor")))
         marker-switch (when (and (not pre-block?)
                                  (not html-export?))
                         (marker-switch t))
@@ -1735,7 +1737,7 @@
         elem (if heading-level
                (keyword (str "h" heading-level
                              (when block-ref? ".inline")))
-               :span.inline-flex.items-center)]
+               :span.inline)]
     (->elem
      elem
      (merge

+ 2 - 2
src/main/frontend/components/plugins.cljs

@@ -81,10 +81,10 @@
               group-first?      (:group-first opt)
               plg               (get (:plugin/installed-plugins @state/state) (keyword (:pid opt)))]
           [:div
+           {:key (str idx (:name opt))}
            (when (and group-first? (not= idx 0)) [:hr.my-2])
            [:div.it.flex.px-3.py-1.5.rounded-sm.justify-between
-            {:key      (str idx (:url opt))
-             :title    (:description opt)
+            {:title    (:description opt)
              :class    (util/classnames
                         [{:is-selected current-selected?
                           :is-active   (= idx @*cursor)}])

File diff suppressed because it is too large
+ 0 - 0
src/main/frontend/components/svg.cljs


+ 1 - 0
src/main/frontend/components/theme.css

@@ -48,6 +48,7 @@ html {
   border-color: var(--ls-page-checkbox-border-color, #6093a0);
   border: none;
   position: relative;
+  top: -1px;
 }
 
 .form-checkbox:hover {

+ 1 - 1
src/main/frontend/handler/editor.cljs

@@ -2572,7 +2572,7 @@
 
       ;; just delete
       :else
-      (do
+      (when-not (mobile-util/native-ios?)
         (util/stop e)
         (delete-and-update
          input (util/safe-dec-current-pos-from-end (.-value input) current-pos) current-pos)))))

+ 30 - 32
src/main/frontend/handler/ui.cljs

@@ -13,7 +13,6 @@
             [goog.object :as gobj]
             [clojure.string :as string]
             [rum.core :as rum]
-            [frontend.mobile.util :as mobile]
             [electron.ipc :as ipc]))
 
 (defn- get-css-var-value
@@ -135,37 +134,36 @@
 
 (defn exec-js-if-exists-&-allowed!
   [t]
-  (when-not (mobile/native-platform?)
-    (when-let [href (or
-                     (state/get-custom-js-link)
-                     (config/get-custom-js-path))]
-      (let [k (str "ls-js-allowed-" href)
-            execed #(swap! *js-execed conj href)
-            execed? (contains? @*js-execed href)
-            ask-allow #(let [r (js/confirm (t :plugin/custom-js-alert))]
-                         (if r
-                           (storage/set k (js/Date.now))
-                           (storage/set k false))
-                         r)
-            allowed! (storage/get k)
-            should-ask? (or (nil? allowed!)
-                            (> (- (js/Date.now) allowed!) 604800000))]
-        (when (and (not execed?)
-                   (not= false allowed!))
-          (if (string/starts-with? href "http")
-            (when (or (not should-ask?)
-                      (ask-allow))
-              (load href #(do (js/console.log "[custom js]" href) (execed))))
-            (util/p-handle
-             (fs/read-file (if (util/electron?) "" (config/get-repo-dir (state/get-current-repo))) href)
-             #(when-let [scripts (and % (string/trim %))]
-                (when-not (string/blank? scripts)
-                  (when (or (not should-ask?) (ask-allow))
-                    (try
-                      (js/eval scripts)
-                      (execed)
-                      (catch js/Error e
-                        (js/console.error "[custom js]" e)))))))))))))
+  (when-let [href (or
+                   (state/get-custom-js-link)
+                   (config/get-custom-js-path))]
+    (let [k (str "ls-js-allowed-" href)
+          execed #(swap! *js-execed conj href)
+          execed? (contains? @*js-execed href)
+          ask-allow #(let [r (js/confirm (t :plugin/custom-js-alert))]
+                       (if r
+                         (storage/set k (js/Date.now))
+                         (storage/set k false))
+                       r)
+          allowed! (storage/get k)
+          should-ask? (or (nil? allowed!)
+                          (> (- (js/Date.now) allowed!) 604800000))]
+      (when (and (not execed?)
+                 (not= false allowed!))
+        (if (string/starts-with? href "http")
+          (when (or (not should-ask?)
+                    (ask-allow))
+            (load href #(do (js/console.log "[custom js]" href) (execed))))
+          (util/p-handle
+           (fs/read-file (if (util/electron?) "" (config/get-repo-dir (state/get-current-repo))) href)
+           #(when-let [scripts (and % (string/trim %))]
+              (when-not (string/blank? scripts)
+                (when (or (not should-ask?) (ask-allow))
+                  (try
+                    (js/eval scripts)
+                    (execed)
+                    (catch js/Error e
+                      (js/console.error "[custom js]" e))))))))))))
 
 (defn toggle-wide-mode!
   []

+ 22 - 19
src/main/frontend/mobile/footer.cljs

@@ -6,15 +6,17 @@
             [frontend.state :as state]
             [frontend.ui :as ui]
             [frontend.util :as util]
-            [rum.core :as rum]))
+            [rum.core :as rum]
+            [frontend.components.svg :as svg]))
 
 (rum/defc mobile-bar-command [command-handler icon]
-  [:div
-   [:button.bottom-action
-    {:on-mouse-down (fn [e]
-                      (util/stop e)
-                      (command-handler))}
-    (ui/icon icon {:style {:fontSize ui/icon-size}})]])
+  [:button.bottom-action
+   {:on-mouse-down (fn [e]
+                     (util/stop e)
+                     (command-handler))}
+   (if (= icon "player-stop")
+     svg/circle-stop
+     (ui/icon icon {:style {:fontSize ui/icon-size}}))])
 
 (defn seconds->minutes:seconds
   [seconds]
@@ -35,14 +37,15 @@
   [state]
   (when (= (state/sub :editor/record-status) "RECORDING")
     (swap! *record-start inc))
-  [:div.flex.flex-row
-   (if (= (state/sub :editor/record-status) "NONE")
-     (do
-       (reset! *record-start -1)
-       (mobile-bar-command #(record/start-recording) "microphone"))
-     [:div.flex.flex-row
-      (mobile-bar-command #(record/stop-recording) "player-stop")
-      [:div.timer.pl-2 (seconds->minutes:seconds @*record-start)]])])
+  (if (= (state/sub :editor/record-status) "NONE")
+    (do
+      (reset! *record-start -1)
+      (mobile-bar-command record/start-recording "microphone"))
+    [:div.flex.flex-row.items-center
+     (mobile-bar-command record/stop-recording "player-stop")
+     [:div.timer.pl-2
+      {:on-click record/stop-recording}
+      (seconds->minutes:seconds @*record-start)]]))
 
 (rum/defc footer < rum/reactive
   []
@@ -55,8 +58,8 @@
       #(let [page (or (state/get-current-page)
                       (string/lower-case (date/journal-name)))]
          (editor-handler/api-insert-new-block!
-                    ""
-                    {:page page
-                     :edit-block? true
-                     :replace-empty-target? true}))
+          ""
+          {:page page
+           :edit-block? true
+           :replace-empty-target? true}))
       "edit")]))

+ 8 - 4
src/main/frontend/mobile/index.css

@@ -11,7 +11,7 @@
     height: 80px;
     /* border-top: 1.5px solid var(--ls-tertiary-border-color); */
     box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.10);
-    
+
     .ti, .timer {
         color: var(--ls-primary-text-color);
         opacity: 0.5;
@@ -87,12 +87,12 @@
           left: 0px;
           height: 40px;
       }
-      
+
       .show-submenu {
           display: block;
       }
   }
-  
+
   .toolbar-commands {
     justify-content: space-between;
     display: flex;
@@ -188,10 +188,14 @@ html.is-zoomed-native-ios {
     .cp__footer {
         height: 70px;
     }
-    
+
     @media (orientation: landscape) {
         .cp__footer {
             height: 50px;
         }
     }
 }
+
+.bottom-action {
+    line-height: 1.15;
+}

+ 5 - 2
src/main/frontend/modules/shortcut/before.cljs

@@ -1,6 +1,7 @@
 (ns frontend.modules.shortcut.before
   (:require [frontend.state :as state]
-            [frontend.util :as util]))
+            [frontend.util :as util]
+            [frontend.mobile.util :as mobile-util]))
 
 ;; before function
 (defn prevent-default-behavior
@@ -23,7 +24,9 @@
   [f]
   (fn [e]
     (when (state/editing?)
-      (util/stop e)
+      (if (mobile-util/native-ios?)
+        (util/stop-propagation e)
+        (util/stop e))
       (f e))))
 
 (defn enable-when-not-component-editing!

+ 1 - 1
src/main/frontend/ui.cljs

@@ -295,7 +295,7 @@
     (when-let [custom-theme (state/sub [:ui/custom-theme (keyword theme)])]
       (when-let [url (:url custom-theme)]
         (js/LSPluginCore.selectTheme (bean/->js custom-theme)
-                                     (bean/->js {:effect false :emit false}))
+                                     (bean/->js {:emit false}))
         (state/set-state! :plugin/selected-theme url)))))
 
 (defn setup-system-theme-effect!

Some files were not shown because too many files changed in this diff