Browse Source

fix: disable nonsensical things for publishing

Disable graph creation and more ways to alter blocks in publishing
Gabriel Horner 3 months ago
parent
commit
101fa65012

+ 1 - 1
src/main/frontend/components/block.cljs

@@ -2814,7 +2814,7 @@
                                   :on-click #(db-property-handler/delete-property-value! (:db/id block) :block/tags (:db/id tag))}
                                  "Remove tag"))])
                            popup-opts))}
-      (if (and @*hover? (not private-tag?))
+      (if (and @*hover? (not private-tag?) (not config/publishing?))
         [:a.inline-flex.text-muted-foreground
          {:title "Remove this tag"
           :style {:margin-top 1

+ 2 - 1
src/main/frontend/components/right_sidebar.cljs

@@ -8,6 +8,7 @@
             [frontend.components.page :as page]
             [frontend.components.profiler :as profiler]
             [frontend.components.shortcut-help :as shortcut-help]
+            [frontend.config :as config]
             [frontend.context.i18n :refer [t]]
             [frontend.date :as date]
             [frontend.db :as db]
@@ -437,7 +438,7 @@
                                                                      (state/sidebar-add-block! repo "help" :help))}
           (t :right-side-bar/help)]]
 
-        (when (state/sub [:ui/developer-mode?])
+        (when (and (state/sub [:ui/developer-mode?]) (not config/publishing?))
           [:div.text-sm
            [:button.button.cp__right-sidebar-settings-btn {:on-click (fn [_e]
                                                                        (state/sidebar-add-block! repo "rtc" :rtc))}

+ 3 - 0
src/main/frontend/modules/shortcut/config.cljs

@@ -462,9 +462,11 @@
                                              :binding []}
 
    :graph/add                               {:fn      (fn [] (route-handler/redirect! {:to :graphs}))
+                                             :inactive config/publishing?
                                              :binding []}
 
    :graph/db-add                            {:fn #(state/pub-event! [:graph/new-db-graph])
+                                             :inactive config/publishing?
                                              :binding false}
 
    :graph/db-save                           {:fn #(state/pub-event! [:graph/save-db-to-disk])
@@ -541,6 +543,7 @@
 
    :editor/quick-add                        {:binding (if mac? "mod+e" "mod+alt+e")
                                              :db-graph? true
+                                             :inactive config/publishing?
                                              :fn      editor-handler/quick-add}
    :editor/jump                             {:binding "mod+j"
                                              :fn      jump-handler/jump-to}