From 27a6d6ee842299afd7f0667efe21cd2e4de796fe Mon Sep 17 00:00:00 2001 From: Eva Marco Date: Wed, 21 Oct 2026 12:02:11 +0200 Subject: [PATCH] :bug: Keep the History button and shortcut in Inspect mode The History button in the header and the Ctrl+Alt+H shortcut were hidden or blocked whenever the workspace was read-only. That flag is on for viewers, but also for editors in the Inspect tab, so editors lost History there although opening it changes nothing in the file. Both now check the edit permission instead: viewers still never get History, and editors keep it in Inspect mode. They stay hidden during a version preview, as before. AI-assisted-by: claude-opus-5-5 --- frontend/src/app/main/data/workspace/shortcuts.cljs | 7 +++++-- frontend/src/app/main/refs.cljs | 3 +++ frontend/src/app/main/ui/workspace/right_header.cljs | 7 ++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/frontend/src/app/main/data/workspace/shortcuts.cljs b/frontend/src/app/main/data/workspace/shortcuts.cljs index bdbd3cedaf..a5bcfe6ac3 100644 --- a/frontend/src/app/main/data/workspace/shortcuts.cljs +++ b/frontend/src/app/main/data/workspace/shortcuts.cljs @@ -652,8 +652,11 @@ :command (ds/ca-mod "h") :subsections [:panels] :section [:workspace] - :fn #(emit-when-no-readonly - (dw/toggle-layout-flag :document-history))} + ;; 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! (dw/toggle-layout-flag :document-history)))} :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 84f6bd72f2..053ef32790 100644 --- a/frontend/src/app/main/refs.cljs +++ b/frontend/src/app/main/refs.cljs @@ -335,6 +335,9 @@ (def workspace-read-only? (l/derived :read-only? 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 28233e3204..ca085d3380 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.icon-button :refer [icon-button*]] [app.main.ui.ds.foundations.assets.icon :as i] @@ -116,7 +115,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) @@ -226,7 +225,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)} [:button {:title (tr "workspace.sidebar.history")