A project you may only look at takes no edit, and greys what would make one
It used to take the edit and never save it, so a drawing stayed until the next reload and was gone after. `edit/edit-entry`, the one way a person changes the document, now refuses every edit when you cannot edit, rather than each command checking for itself; renaming the project and regenerating settings, which go around it, check too. The stage only selects, and the drawing tools, swatches, inspector fields, the timeline's edit buttons and the pool's add and upload are greyed out. Selecting, inspecting, playing and the view's own settings stay. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
00e94c025a
commit
ef06f51d91
7 changed files with 68 additions and 10 deletions
27
frontend/test/arthur/events/read_only_test.cljs
Normal file
27
frontend/test/arthur/events/read_only_test.cljs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
(ns arthur.events.read-only-test
|
||||
(:require [cljs.test :refer [deftest is]]
|
||||
[arthur.domain.clip :as clip]
|
||||
[arthur.domain.paint :as paint]
|
||||
[arthur.events.ui :as ui]
|
||||
[arthur.footage.store :as store]
|
||||
[arthur.subs.ui :as sub]
|
||||
[re-frame.core :as rf]
|
||||
[re-frame.db :as rf-db]))
|
||||
|
||||
(deftest a-project-you-may-only-look-at-takes-no-edit
|
||||
(let [doc (paint/new-shape (clip/blank) :main :s 0 [0 0 10 0 20 10 10 20 0 20] 1)
|
||||
id (store/install! {:clip doc :store {}} "read-only")
|
||||
shape #(get-in (:clip (store/entry (:clip/current @rf-db/app-db))) [:symbols :main :nodes :s])]
|
||||
(reset! rf-db/app-db {:clip/current id :paint/revision 0
|
||||
:project {:can-edit? false}
|
||||
:ui {:open :main :tool :brush :selection [:node :main :s [:s]]
|
||||
:selections [[:node :main :s [:s]]]}
|
||||
:playback {:frame 0}})
|
||||
(is (= :select @(rf/subscribe [::sub/tool])) "the stage only selects")
|
||||
(rf/dispatch-sync [::ui/delete-selected])
|
||||
(is (some? (shape)) "Delete deletes nothing")
|
||||
(is (= 0 (:paint/revision @rf-db/app-db)) "and nothing became unsaved")
|
||||
(swap! rf-db/app-db #(-> % (assoc-in [:project :can-edit?] true) (update :ui assoc :tool :select :selection [:node :main :s [:s]]
|
||||
:selections [[:node :main :s [:s]]])))
|
||||
(rf/dispatch-sync [::ui/delete-selected])
|
||||
(is (nil? (shape)) "an editor's Delete does")))
|
||||
Loading…
Add table
Add a link
Reference in a new issue