소스 검색

fix: disable property editing in publishing

Gabriel Horner 2 년 전
부모
커밋
997aa5535a
2개의 변경된 파일21개의 추가작업 그리고 17개의 파일을 삭제
  1. 20 16
      src/main/frontend/components/property/value.cljs
  2. 1 1
      src/main/frontend/ui.cljs

+ 20 - 16
src/main/frontend/components/property/value.cljs

@@ -439,19 +439,21 @@
                                      "origin-top-right.absolute.left-0.rounded-md.shadow-lg.mt-2")
                                      "origin-top-right.absolute.left-0.rounded-md.shadow-lg.mt-2")
                        :initial-open? editing?}]
                        :initial-open? editing?}]
     (if editing?
     (if editing?
-      (select-f)
-      (ui/dropdown
-       (fn [{:keys [toggle-fn]}]
-         [:div.cursor-pointer
-          {:on-mouse-down (fn [e]
-                            (util/stop e)
-                            (toggle-fn))
-           :class "flex flex-1"}
-          (if (and (string/blank? value) (not editing?))
-            [:div.opacity-50.pointer.text-sm "Empty"]
-            (value-f))])
-       select-f
-       dropdown-opts))))
+        (select-f)
+        (ui/dropdown
+         (fn [{:keys [toggle-fn]}]
+           [:div.cursor-pointer
+            {:on-mouse-down (if config/publishing?
+                              (constantly nil)
+                              (fn [e]
+                                (util/stop e)
+                                (toggle-fn)))
+             :class "flex flex-1"}
+            (if (and (string/blank? value) (not editing?))
+              [:div.opacity-50.pointer.text-sm "Empty"]
+              (value-f))])
+         select-f
+         dropdown-opts))))
 
 
 (rum/defc property-scalar-value < rum/reactive db-mixins/query
 (rum/defc property-scalar-value < rum/reactive db-mixins/query
   [block property value {:keys [inline-text block-cp
   [block property value {:keys [inline-text block-cp
@@ -566,9 +568,11 @@
       (ui/dropdown
       (ui/dropdown
        (fn [{:keys [toggle-fn]}]
        (fn [{:keys [toggle-fn]}]
          [:div.cursor-pointer
          [:div.cursor-pointer
-          {:on-mouse-down (fn [e]
-                            (util/stop e)
-                            (toggle-fn))
+          {:on-mouse-down (if config/publishing?
+                            (constantly nil)
+                            (fn [e]
+                              (util/stop e)
+                              (toggle-fn)))
            :class "flex flex-1 flex-row items-center flex-wrap gap-x-4 gap-y-2 pr-4"}
            :class "flex flex-1 flex-row items-center flex-wrap gap-x-4 gap-y-2 pr-4"}
           (values-cp toggle-fn)])
           (values-cp toggle-fn)])
        (fn [{:keys [_toggle-fn]}]
        (fn [{:keys [_toggle-fn]}]

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

@@ -368,7 +368,7 @@
 (defn checkbox
 (defn checkbox
   [option]
   [option]
   [:input.form-checkbox.h-4.w-4.transition.duration-150.ease-in-out
   [:input.form-checkbox.h-4.w-4.transition.duration-150.ease-in-out
-   (merge {:type "checkbox"} option)])
+   (merge {:type "checkbox" :disabled config/publishing?} option)])
 
 
 (defn main-node
 (defn main-node
   []
   []