Pārlūkot izejas kodu

fix(ui): page crash for the whiteboard title context menu

charlie 1 gadu atpakaļ
vecāks
revīzija
bc8913b206

+ 6 - 5
src/main/frontend/components/page_menu.cljs

@@ -104,13 +104,14 @@
              :options {:on-click #(delete-page-confirm! page)}})
              :options {:on-click #(delete-page-confirm! page)}})
 
 
           (when (and (not (mobile-util/native-platform?))
           (when (and (not (mobile-util/native-platform?))
-                     (state/get-current-page))
+                  (not whiteboard?)
+                  (state/get-current-page))
             {:title (t :page/slide-view)
             {:title (t :page/slide-view)
              :options {:on-click (fn []
              :options {:on-click (fn []
                                    (state/sidebar-add-block!
                                    (state/sidebar-add-block!
-                                    repo
-                                    (:db/id page)
-                                    :page-slide-view))}})
+                                     repo
+                                     (:db/id page)
+                                     :page-slide-view))}})
 
 
           ;; TODO: In the future, we'd like to extract file-related actions
           ;; TODO: In the future, we'd like to extract file-related actions
           ;; (such as open-in-finder & open-with-default-app) into a sub-menu of
           ;; (such as open-in-finder & open-with-default-app) into a sub-menu of
@@ -153,7 +154,7 @@
                :options {:on-click #(commands/exec-plugin-simple-command!
                :options {:on-click #(commands/exec-plugin-simple-command!
                                      pid (assoc cmd :page page-name) action)}}))
                                      pid (assoc cmd :page page-name) action)}}))
 
 
-          (when db-based?
+          (when (and db-based? (not whiteboard?))
             {:title (t :page/toggle-properties)
             {:title (t :page/toggle-properties)
              :options {:on-click (fn []
              :options {:on-click (fn []
                                    (page-handler/toggle-properties! page))}})
                                    (page-handler/toggle-properties! page))}})

+ 1 - 7
src/main/frontend/components/whiteboard.cljs

@@ -261,13 +261,7 @@
       {:data-html2canvas-ignore true} ; excludes title component from image export
       {:data-html2canvas-ignore true} ; excludes title component from image export
       [:div.whiteboard-page-title
       [:div.whiteboard-page-title
        {:style {:color "var(--ls-primary-text-color)"
        {:style {:color "var(--ls-primary-text-color)"
-                :user-select "none"}
-        :on-context-menu (fn [e]
-                           (util/stop e)
-                           (common-handler/show-custom-context-menu!
-                            e
-                            (content/page-title-custom-context-menu-content page))
-                           (state/set-state! :page-title/context nil))}
+                :user-select "none"}}
        (page/page-title page {:*hover? (atom false)})]
        (page/page-title page {:*hover? (atom false)})]
 
 
       [:div.whiteboard-page-refs
       [:div.whiteboard-page-refs

+ 0 - 5
src/main/frontend/handler/common.cljs

@@ -60,11 +60,6 @@
                     (util/time-ms)))))
                     (util/time-ms)))))
     pages))
     pages))
 
 
-(defn show-custom-context-menu! [e context-menu-content]
-  (util/stop e)
-  (let [position [(gobj/get e "clientX") (gobj/get e "clientY")]]
-    (state/show-custom-context-menu! context-menu-content position)))
-
 (defn listen-to-scroll!
 (defn listen-to-scroll!
   [element]
   [element]
   (let [*scroll-timer (atom nil)
   (let [*scroll-timer (atom nil)