From 0a1f5e059c76b7a147c00b8fd8f2271065dc4029 Mon Sep 17 00:00:00 2001 From: Konstantinos Kaloutas Date: Mon, 27 Mar 2023 11:16:27 +0300 Subject: [PATCH] fix: hide delete image button --- src/main/frontend/components/block.cljs | 49 +++++++++++++------------ 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/src/main/frontend/components/block.cljs b/src/main/frontend/components/block.cljs index 7a4931e86..10ed5130b 100644 --- a/src/main/frontend/components/block.cljs +++ b/src/main/frontend/components/block.cljs @@ -323,30 +323,31 @@ (js/window.apis.openExternal image-src)))} image-src]) [:.flex - [:button.asset-action-btn - {:title (t :asset/delete) - :tabIndex "-1" - :on-mouse-down util/stop - :on-click - (fn [e] - (when-let [block-id (:block/uuid config)] - (let [confirm-fn (ui/make-confirm-modal - {:title (t :asset/confirm-delete (.toLocaleLowerCase (t :text/image))) - :sub-title (if local? :asset/physical-delete "") - :sub-checkbox? local? - :on-confirm (fn [_e {:keys [close-fn sub-selected]}] - (close-fn) - (editor-handler/delete-asset-of-block! - {:block-id block-id - :local? local? - :delete-local? (and sub-selected (first sub-selected)) - :repo (state/get-current-repo) - :href src - :title title - :full-text full_text}))})] - (util/stop e) - (state/set-modal! confirm-fn))))} - (ui/icon "trash")] + (when-not config/publishing? + [:button.asset-action-btn + {:title (t :asset/delete) + :tabIndex "-1" + :on-mouse-down util/stop + :on-click + (fn [e] + (when-let [block-id (:block/uuid config)] + (let [confirm-fn (ui/make-confirm-modal + {:title (t :asset/confirm-delete (.toLocaleLowerCase (t :text/image))) + :sub-title (if local? :asset/physical-delete "") + :sub-checkbox? local? + :on-confirm (fn [_e {:keys [close-fn sub-selected]}] + (close-fn) + (editor-handler/delete-asset-of-block! + {:block-id block-id + :local? local? + :delete-local? (and sub-selected (first sub-selected)) + :repo (state/get-current-repo) + :href src + :title title + :full-text full_text}))})] + (util/stop e) + (state/set-modal! confirm-fn))))} + (ui/icon "trash")]) [:button.asset-action-btn {:title (t :asset/copy)