瀏覽代碼

fix: allow custom context menu

Konstantinos Kaloutas 2 年之前
父節點
當前提交
4282f21a62
共有 1 個文件被更改,包括 28 次插入30 次删除
  1. 28 30
      src/main/frontend/components/content.cljs

+ 28 - 30
src/main/frontend/components/content.cljs

@@ -354,38 +354,36 @@
                             block-id (d/attr target "blockid")
                             {:keys [block block-ref]} (state/sub :block-ref/context)
                             {:keys [page]} (state/sub :page-title/context)]
-                        ;; TODO: Find a better way to handle this on whiteboards
-                        (when-not (whiteboard-handler/inside-portal? target)
-                          (cond
-                            page
-                            (do
-                              (common-handler/show-custom-context-menu!
-                               e
-                               (page-title-custom-context-menu-content page))
-                              (state/set-state! :page-title/context nil))
-
-                            block-ref
-                            (do
-                              (common-handler/show-custom-context-menu!
-                               e
-                               (block-ref-custom-context-menu-content block block-ref))
-                              (state/set-state! :block-ref/context nil))
-
-                            (and (state/selection?) (not (d/has-class? target "bullet")))
+                        (cond
+                          page
+                          (do
                             (common-handler/show-custom-context-menu!
                              e
-                             (custom-context-menu-content))
-
-                            (and block-id (parse-uuid block-id))
-                            (let [block (.closest target ".ls-block")]
-                              (when block
-                                (util/select-highlight! [block]))
-                              (common-handler/show-custom-context-menu!
-                               e
-                               (block-context-menu-content target (uuid block-id))))
-
-                            :else
-                            nil)))))))
+                             (page-title-custom-context-menu-content page))
+                            (state/set-state! :page-title/context nil))
+
+                          block-ref
+                          (do
+                            (common-handler/show-custom-context-menu!
+                             e
+                             (block-ref-custom-context-menu-content block block-ref))
+                            (state/set-state! :block-ref/context nil))
+
+                          (and (state/selection?) (not (d/has-class? target "bullet")))
+                          (common-handler/show-custom-context-menu!
+                           e
+                           (custom-context-menu-content))
+
+                          (and block-id (parse-uuid block-id))
+                          (let [block (.closest target ".ls-block")]
+                            (when block
+                              (util/select-highlight! [block]))
+                            (common-handler/show-custom-context-menu!
+                             e
+                             (block-context-menu-content target (uuid block-id))))
+
+                          :else
+                          nil))))))
   [id {:keys [hiccup]}]
   [:div {:id id}
    (if hiccup