Browse Source

Disable editing classes + props in publishing

Gabriel Horner 2 years ago
parent
commit
ab502991d5

+ 3 - 2
src/main/frontend/components/content.cljs

@@ -28,7 +28,8 @@
             [goog.dom :as gdom]
             [goog.object :as gobj]
             [rum.core :as rum]
-            [logseq.graph-parser.property :as gp-property]))
+            [logseq.graph-parser.property :as gp-property]
+            [frontend.config :as config]))
 
 ;; TODO i18n support
 
@@ -408,7 +409,7 @@
                           (and property-id property-block-id)
                           (let [block (db/entity [:block/uuid (uuid property-block-id)])
                                 property (db/entity [:block/uuid (uuid property-id)])]
-                            (when (and block property)
+                            (when (and block property (not config/publishing?))
                               (common-handler/show-custom-context-menu!
                                e
                                (property-custom-context-menu-content block

+ 1 - 0
src/main/frontend/components/page.cljs

@@ -366,6 +366,7 @@
                   db-based?
                   (not built-in-property?)
                   (not @*edit?)
+                  (not config/publishing?)
                   (not (seq (:block/properties page)))
                   (not (seq (:block/alias page)))
                   (not (seq (:block/tags page))))

+ 4 - 2
src/main/frontend/components/property.cljs

@@ -2,6 +2,7 @@
   "Block properties management."
   (:require [clojure.set :as set]
             [clojure.string :as string]
+            [frontend.config :as config]
             [frontend.components.property.value :as pv]
             [frontend.components.select :as select]
             [frontend.db :as db]
@@ -304,8 +305,9 @@
           :on-click toggle-fn}
          [:div.ml-1 (:block/original-name property)]])
       (fn [{:keys [toggle-fn]}]
-        [:div.p-8
-         (property-config repo property {:toggle-fn toggle-fn})])
+        (when (not config/publishing?)
+          [:div.p-8
+          (property-config repo property {:toggle-fn toggle-fn})]))
       {:modal-class (util/hiccup->class
                      "origin-top-right.absolute.left-0.rounded-md.shadow-lg")})]))