Просмотр исходного кода

feat(gesture): add copy block url to action bar

llcc 3 лет назад
Родитель
Сommit
0bc7f9f36b

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

@@ -35,7 +35,7 @@
             [frontend.handler.mobile.swipe :as swipe]
             [frontend.components.onboarding :as onboarding]
             [frontend.mobile.footer :as footer]
-            [frontend.mobile.action-sheet :as action-sheet]))
+            [frontend.mobile.action-bar :as action-bar]))
 
 (rum/defc nav-content-item
   [name {:keys [class]} child]
@@ -296,7 +296,7 @@
      [:div#main-content-container.scrollbar-spacing.w-full.flex.justify-center.flex-row
 
       (when show-action-bar?
-        (action-sheet/action-bar))
+        (action-bar/action-bar))
       
       [:div.cp__sidebar-main-content
        {:data-is-global-graph-pages global-graph-pages?

+ 18 - 11
src/main/frontend/mobile/action_sheet.cljs → src/main/frontend/mobile/action_bar.cljs

@@ -1,14 +1,16 @@
-(ns frontend.mobile.action-sheet
-  (:require [frontend.db :as db]
-            [frontend.extensions.srs :as srs]
-            [frontend.handler.editor :as editor-handler]
-            [frontend.mixins :as mixins]
-            [frontend.state :as state]
-            [frontend.ui :as ui]
-            [frontend.util :as util]
-            [goog.dom :as gdom]
-            [goog.object :as gobj]
-            [rum.core :as rum]))
+(ns frontend.mobile.action-bar
+  (:require
+   [frontend.db :as db]
+   [frontend.extensions.srs :as srs]
+   [frontend.handler.editor :as editor-handler]
+   [frontend.mixins :as mixins]
+   [frontend.state :as state]
+   [frontend.ui :as ui]
+   [frontend.util :as util]
+   [frontend.util.url :as url-util]
+   [goog.dom :as gdom]
+   [goog.object :as gobj]
+   [rum.core :as rum]))
 
 (defn- action-command
   [icon description command-handler]
@@ -58,5 +60,10 @@
        (action-command "copy" "Copy" #(editor-handler/copy-selection-blocks))
        (action-command "registered" "Copy ref"
                        (fn [_event] (editor-handler/copy-block-ref! uuid #(str "((" % "))"))))
+       (action-command "link" "Copy url"
+                       (fn [_event] (let [current-repo (state/get-current-repo)
+                                          tap-f (fn [block-id]
+                                                  (url-util/get-logseq-graph-uuid-url nil current-repo block-id))]
+                                      (editor-handler/copy-block-ref! uuid tap-f))))
        (action-command "cut" "Cut" #(editor-handler/cut-selection-blocks true))
        (action-command "trash" "Delete" #(editor-handler/delete-block-aux! block true))])))

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

@@ -32,6 +32,7 @@
     border-radius: 10px;
     box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05);
     z-index: 100;
+    overflow-x: overlay;
     
     .ti {
         color: var(--ls-primary-text-color);
@@ -45,15 +46,13 @@
     }
 
     button {
-        padding: 7px 10px;
-        border: 10px;
+        padding: 5px 6px;
     }
 }
 
 html.is-native-ipad {
     .cp__footer {
         height: 55px;
-        /* width: calc(100vw - var(--ls-left-sidebar-width)); */
         right: 0;
         box-shadow: none;
         flex: 1;
@@ -68,8 +67,8 @@ html.is-native-ipad {
 html.is-native-iphone {
 
     .action-bar {
-        left: 5%;
-        right: 5%;
+        left: 3%;
+        right: 3%;
     }
     
     @media (orientation: landscape) {