diff --git a/backend/src/app/rpc/commands/files_thumbnails.clj b/backend/src/app/rpc/commands/files_thumbnails.clj index 1db0c4ccd8..28105314e6 100644 --- a/backend/src/app/rpc/commands/files_thumbnails.clj +++ b/backend/src/app/rpc/commands/files_thumbnails.clj @@ -144,8 +144,8 @@ (run! pmap/load!)) ;; Then proceed to find the frame set for thumbnail - - (d/seek :use-for-thumbnail? + (d/seek #(or (:use-for-thumbnail %) + (:use-for-thumbnail? %)) ; NOTE: backward comp (remove on v1.21) (for [page (-> data :pages-index vals) frame (-> page :objects ctt/get-frames)] (assoc frame :page-id (:id page))))) diff --git a/common/src/app/common/files/defaults.cljc b/common/src/app/common/files/defaults.cljc index 3cfaccf207..7f0ff7c137 100644 --- a/common/src/app/common/files/defaults.cljc +++ b/common/src/app/common/files/defaults.cljc @@ -6,4 +6,4 @@ (ns app.common.files.defaults) -(def version 30) +(def version 31) diff --git a/common/src/app/common/files/migrations.cljc b/common/src/app/common/files/migrations.cljc index df4144c87b..14a1a5a977 100644 --- a/common/src/app/common/files/migrations.cljc +++ b/common/src/app/common/files/migrations.cljc @@ -576,3 +576,18 @@ (-> data (update :pages-index update-vals update-container) (update :components update-vals update-container)))) + +(defmethod migrate 31 + [data] + (letfn [(update-object [object] + (cond-> object + (contains? object :use-for-thumbnail?) + (-> (assoc :use-for-thumbnail (:use-for-thumbnail? object)) + (dissoc :use-for-thumbnail?)))) + + (update-container [container] + (d/update-when container :objects update-vals update-object))] + + (-> data + (update :pages-index update-vals update-container) + (update :components update-vals update-container)))) diff --git a/frontend/src/app/main/data/workspace.cljs b/frontend/src/app/main/data/workspace.cljs index a9d9ce0bff..7d3cdf6136 100644 --- a/frontend/src/app/main/data/workspace.cljs +++ b/frontend/src/app/main/data/workspace.cljs @@ -462,7 +462,7 @@ fdata (:workspace-data state) components-v2 (dm/get-in fdata [:options :components-v2]) objects (->> (:objects page) - (d/mapm (fn [_ val] (dissoc val :use-for-thumbnail?)))) + (d/mapm (fn [_ val] (dissoc val :use-for-thumbnail)))) main-instances-ids (set (keep #(when (ctk/main-instance? (val %)) (key %)) objects)) ids-to-remove (set (apply concat (map #(cph/get-children-ids objects %) main-instances-ids))) diff --git a/frontend/src/app/main/data/workspace/selection.cljs b/frontend/src/app/main/data/workspace/selection.cljs index 94680787c0..50d8e65259 100644 --- a/frontend/src/app/main/data/workspace/selection.cljs +++ b/frontend/src/app/main/data/workspace/selection.cljs @@ -450,8 +450,8 @@ :frame-id frame-id) (dissoc :shapes - :main-instance? - :use-for-thumbnail?) + :main-instance + :use-for-thumbnail) (cond-> (or frame? group? bool?) diff --git a/frontend/src/app/main/data/workspace/shapes.cljs b/frontend/src/app/main/data/workspace/shapes.cljs index 9631d626ee..7c59da35ba 100644 --- a/frontend/src/app/main/data/workspace/shapes.cljs +++ b/frontend/src/app/main/data/workspace/shapes.cljs @@ -504,7 +504,7 @@ pages (-> state :workspace-data :pages-index vals)] (rx/concat - ;; First: clear the `:use-for-thumbnail?` flag from all not + ;; First: clear the `:use-for-thumbnail` flag from all not ;; selected frames. (rx/from (->> pages @@ -512,13 +512,13 @@ (fn [{:keys [objects id] :as page}] (->> (ctst/get-frames objects) (sequence - (comp (filter :use-for-thumbnail?) + (comp (filter :use-for-thumbnail) (map :id) (remove selected) (map (partial vector id))))))) (d/group-by first second) (map (fn [[page-id frame-ids]] - (dch/update-shapes frame-ids #(dissoc % :use-for-thumbnail?) {:page-id page-id}))))) + (dch/update-shapes frame-ids #(dissoc % :use-for-thumbnail) {:page-id page-id}))))) ;; And finally: toggle the flag value on all the selected shapes - (rx/of (dch/update-shapes selected #(update % :use-for-thumbnail? not)))))))) + (rx/of (dch/update-shapes selected #(update % :use-for-thumbnail not)))))))) diff --git a/frontend/src/app/main/ui/workspace/context_menu.cljs b/frontend/src/app/main/ui/workspace/context_menu.cljs index 80c625f59c..af6e2768f5 100644 --- a/frontend/src/app/main/ui/workspace/context_menu.cljs +++ b/frontend/src/app/main/ui/workspace/context_menu.cljs @@ -237,7 +237,7 @@ do-toggle-thumbnail #(st/emit! (dw/toggle-file-thumbnail-selected))] (when (and single? has-frame?) [:* - (if (every? :use-for-thumbnail? shapes) + (if (every? :use-for-thumbnail shapes) [:& menu-entry {:title (tr "workspace.shape.menu.thumbnail-remove") :on-click do-toggle-thumbnail}] [:& menu-entry {:title (tr "workspace.shape.menu.thumbnail-set") diff --git a/frontend/src/app/main/ui/workspace/viewport/widgets.cljs b/frontend/src/app/main/ui/workspace/viewport/widgets.cljs index 53f56fedc5..bb6fb4a7c9 100644 --- a/frontend/src/app/main/ui/workspace/viewport/widgets.cljs +++ b/frontend/src/app/main/ui/workspace/viewport/widgets.cljs @@ -170,7 +170,7 @@ (on-frame-leave (:id frame)))) main-instance? (ctk/main-instance? frame) - text-pos-x (if (or (:use-for-thumbnail? frame) grid-edition? main-instance?) 15 0)] + text-pos-x (if (or (:use-for-thumbnail frame) grid-edition? main-instance?) 15 0)] (when (not (:hidden frame)) [:g.frame-title {:id (dm/str "frame-title-" (:id frame)) @@ -178,7 +178,7 @@ :transform (vwu/title-transform frame zoom grid-edition?) :pointer-events (when (:blocked frame) "none")} (cond - (or (:use-for-thumbnail? frame) grid-edition? main-instance?) + (or (:use-for-thumbnail frame) grid-edition? main-instance?) [:svg {:x 0 :y -9 :width 12 @@ -187,7 +187,7 @@ :style {:fill color} :visibility (if show-artboard-names? "visible" "hidden")} (cond - (:use-for-thumbnail? frame) + (:use-for-thumbnail frame) [:use {:href "#icon-set-thumbnail"}] grid-edition?