diff --git a/frontend/src/app/main/data/workspace/shortcuts.cljs b/frontend/src/app/main/data/workspace/shortcuts.cljs index 9b8eb6bd09..af35a1e716 100644 --- a/frontend/src/app/main/data/workspace/shortcuts.cljs +++ b/frontend/src/app/main/data/workspace/shortcuts.cljs @@ -655,9 +655,12 @@ :command (ds/ca-mod "h") :subsections [:panels] :section [:workspace] - :fn #(emit-when-no-readonly - (-> (dwh/initialize-history) - (vary-meta assoc ::ev/origin "workspace:shortcuts")))} + ;; Same rule as the header button: editors, also in + ;; Inspect mode, but not during a version preview. + :fn #(when (and (:can-edit (deref refs/permissions)) + (nil? (deref refs/workspace-preview-id))) + (st/emit! (-> (dwh/initialize-history) + (vary-meta assoc ::ev/origin "workspace:shortcuts"))))} :toggle-colorpalette {:tooltip (ds/alt "P") :label (fn [] (tr "shortcuts.toggle-colorpalette")) diff --git a/frontend/src/app/main/refs.cljs b/frontend/src/app/main/refs.cljs index 61baf8e3af..2ed4bc3d5b 100644 --- a/frontend/src/app/main/refs.cljs +++ b/frontend/src/app/main/refs.cljs @@ -338,6 +338,9 @@ (def persistence-lock (l/derived :persistence-lock workspace-global)) +(def workspace-preview-id + (l/derived :preview-id workspace-global)) + (def workspace-paddings-selected (l/derived :paddings-selected workspace-global)) diff --git a/frontend/src/app/main/ui/workspace/right_header.cljs b/frontend/src/app/main/ui/workspace/right_header.cljs index b76ac50fa9..512a0b84a2 100644 --- a/frontend/src/app/main/ui/workspace/right_header.cljs +++ b/frontend/src/app/main/ui/workspace/right_header.cljs @@ -18,7 +18,6 @@ [app.main.refs :as refs] [app.main.store :as st] [app.main.ui.components.dropdown :refer [dropdown]] - [app.main.ui.context :as ctx] [app.main.ui.dashboard.team] [app.main.ui.ds.buttons.button :refer [button*]] [app.main.ui.ds.buttons.icon-button :refer [icon-button*]] @@ -118,7 +117,7 @@ (let [threads-map (mf/deref refs/comment-threads) zoom (mf/deref refs/selected-zoom) - read-only? (mf/use-ctx ctx/workspace-read-only?) + preview-id (mf/deref refs/workspace-preview-id) selected-drawtool (mf/deref refs/selected-drawing-tool) custom-shortcuts (mf/deref refs/custom-shortcuts) @@ -228,7 +227,9 @@ (when ^boolean has-unread-comments? [:div {:class (stl/css :unread)}])]] - (when-not ^boolean read-only? + ;; Editors keep History in Inspect mode; viewers never get it. It stays + ;; hidden during a version preview, as before. + (when (and (:can-edit permissions) (nil? preview-id)) [:div {:class (stl/css :history-section)} [:> icon-button* {:variant "action" :tooltip-placement "bottom-left"