From 9311ee4c87e81d20ec4185f01f3d50c590efc7f6 Mon Sep 17 00:00:00 2001 From: Luis de Dios Date: Mon, 15 Sep 2025 13:13:12 +0200 Subject: [PATCH 1/3] :bug: Fix show in assets panel option for component of variants (#7311) --- .../app/main/ui/workspace/context_menu.cljs | 3 +-- .../ui/workspace/sidebar/assets/common.cljs | 22 ++++++++++++------- .../sidebar/options/menus/component.cljs | 17 +++++++++----- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/context_menu.cljs b/frontend/src/app/main/ui/workspace/context_menu.cljs index 87d8a50dd9..0e0f1b8558 100644 --- a/frontend/src/app/main/ui/workspace/context_menu.cljs +++ b/frontend/src/app/main/ui/workspace/context_menu.cljs @@ -569,8 +569,7 @@ (let [single? (= (count shapes) 1) objects (deref refs/workspace-page-objects) can-make-component (every? true? (map #(ctn/valid-shape-for-component? objects %) shapes)) - heads (filter ctk/instance-head? shapes) - components-menu-entries (cmm/generate-components-menu-entries heads) + components-menu-entries (cmm/generate-components-menu-entries shapes) variant-container? (and single? (ctk/is-variant-container? (first shapes))) all-main? (every? ctk/main-instance? shapes) any-variant? (some ctk/is-variant? shapes) diff --git a/frontend/src/app/main/ui/workspace/sidebar/assets/common.cljs b/frontend/src/app/main/ui/workspace/sidebar/assets/common.cljs index 2fb9829c1d..e7d5647cc2 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/assets/common.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/assets/common.cljs @@ -34,7 +34,7 @@ [app.util.array :as array] [app.util.dom :as dom] [app.util.dom.dnd :as dnd] - [app.util.i18n :as i18n :refer [tr c]] + [app.util.i18n :as i18n :refer [c tr]] [app.util.strings :refer [matches-search]] [app.util.timers :as ts] [cljs.spec.alpha :as s] @@ -358,8 +358,10 @@ ;; For when it's only one shape shape (first shapes) - id (:id shape) + shape-id (:id shape) + main-instance? (ctk/main-instance? shape) + variant-container? (ctk/is-variant-container? shape) component-id (:component-id shape) variant-id (:variant-id shape) @@ -409,7 +411,7 @@ #(st/emit! (dwl/reset-components (map :id touched-not-dangling))) do-update-component-sync - #(st/emit! (dwl/update-component-sync id library-id)) + #(st/emit! (dwl/update-component-sync shape-id library-id)) do-update-remote-component (fn [] @@ -429,21 +431,24 @@ (do-update-remote-component)) do-show-in-assets - #(st/emit! (dw/show-component-in-assets component-id)) + (let [component-id (if variant-container? + (->> (:shapes shape) (mapv #(get objects %)) first :component-id) + component-id)] + #(st/emit! (dw/show-component-in-assets component-id))) do-create-annotation - #(st/emit! (dw/set-annotations-id-for-create id)) + #(st/emit! (dw/set-annotations-id-for-create shape-id)) do-add-variant #(if (ctk/is-variant? shape) (st/emit! (ptk/event ::ev/event {::ev/name "add-new-variant" :trigger (if for-design-tab? "design-tab-menu-variant" "context-menu-variant")}) - (dwv/add-new-variant id)) + (dwv/add-new-variant shape-id)) (st/emit! (ptk/event ::ev/event {::ev/name "transform-in-variant" :trigger (if for-design-tab? "design-tab-menu" "context-menu")}) - (dwv/transform-in-variant id))) + (dwv/transform-in-variant shape-id))) do-add-new-property #(st/emit! @@ -478,7 +483,8 @@ (when (= 1 (count comps-to-restore)) (ts/schedule 1000 #(do-show-component nil true))))) - menu-entries [(when (and (or (not multi) same-variant?) main-instance?) + menu-entries [(when (or (and (not multi) (or variant-container? main-instance?)) + (and multi same-variant?)) {:title (tr "workspace.shape.menu.show-in-assets") :action do-show-in-assets}) (when (and (not multi) main-instance? local-component? lacks-annotation?) diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/component.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/component.cljs index 087f62e74a..46c431ef3a 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/component.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/component.cljs @@ -7,7 +7,6 @@ (ns app.main.ui.workspace.sidebar.options.menus.component (:require-macros [app.main.style :as stl]) (:require - [app.common.data :as d] [app.common.data.macros :as dm] [app.common.files.helpers :as cfh] @@ -1069,13 +1068,14 @@ variants (mapv #(get objects %) (:shapes shape)) variant-id (:variant-id (first variants)) + variant-components (cfv/find-variant-components data objects variant-id) malformed-ids (->> variants (filterv #(some? (:variant-error %))) (mapv :id)) malformed? (d/not-empty? malformed-ids) - duplicated-ids (->> (cfv/find-variant-components data objects variant-id) + duplicated-ids (->> variant-components get-main-ids-with-duplicated-variant-props-and-values) duplicated? (d/not-empty? duplicated-ids) @@ -1088,6 +1088,11 @@ menu-open* (mf/use-state false) menu-open? (deref menu-open*) + show-in-assets-panel + (mf/use-fn + (mf/deps variants) + #(st/emit! (dw/show-component-in-assets (:component-id (first variants))))) + create-variant (mf/use-fn (mf/deps shape) @@ -1104,10 +1109,12 @@ (dwv/add-new-property variant-id {:property-value "Value 1" :editing? true})))) - menu-entries [{:title (tr "workspace.shape.menu.add-variant-property") - :action (partial add-new-property "design-tab-menu-component")} + menu-entries [{:title (tr "workspace.shape.menu.show-in-assets") + :action show-in-assets-panel} {:title (tr "workspace.shape.menu.add-variant") - :action (partial create-variant "design-tab-menu-component")}] + :action (partial create-variant "design-tab-menu-component")} + {:title (tr "workspace.shape.menu.add-variant-property") + :action (partial add-new-property "design-tab-menu-component")}] toggle-content (mf/use-fn From a264f84e6c3610cc2d197db5ffd1ee942d63e66d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Moya?= Date: Tue, 16 Sep 2025 10:57:02 +0200 Subject: [PATCH 2/3] :wrench: Deactivate validation temporarily --- common/src/app/common/files/validate.cljc | 30 +++++++++++------------ 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/common/src/app/common/files/validate.cljc b/common/src/app/common/files/validate.cljc index 02887b5f5e..a2e6bbe832 100644 --- a/common/src/app/common/files/validate.cljc +++ b/common/src/app/common/files/validate.cljc @@ -329,19 +329,19 @@ "This shape has children with the same swap slot" shape file page))) -(defn- check-valid-touched - "Validate that the text touched flags are coherent." - [shape file page] - (let [touched-groups (ctk/normal-touched-groups shape) - content-touched? (touched-groups :content-group) - text-touched? (or (touched-groups :text-content-text) - (touched-groups :text-content-attribute) - (touched-groups :text-content-structure))] +#_(defn- check-valid-touched + "Validate that the text touched flags are coherent." + [shape file page] + (let [touched-groups (ctk/normal-touched-groups shape) + content-touched? (touched-groups :content-group) + text-touched? (or (touched-groups :text-content-text) + (touched-groups :text-content-attribute) + (touched-groups :text-content-structure))] ;; For now we only check this combination, that has been reported in some bugs - (when (and text-touched? (not content-touched?)) - (report-error :invalid-text-touched - "This thape has text type touched but not content touched" - shape file page)))) + (when (and text-touched? (not content-touched?)) + (report-error :invalid-text-touched + "This thape has text type touched but not content touched" + shape file page)))) (defn- check-shape-main-root-top "Root shape of a top main instance: @@ -384,7 +384,7 @@ (check-component-ref shape file page libraries) (check-empty-swap-slot shape file page) (check-duplicate-swap-slot shape file page) - (check-valid-touched shape file page) + #_(check-valid-touched shape file page) ;; TODO: activate this again after we add a migration that repairs files automatically (run! #(check-shape % file page libraries :context :copy-top :library-exists library-exists) (:shapes shape)))) (defn- check-shape-copy-root-nested @@ -395,7 +395,7 @@ [shape file page libraries library-exists] (check-component-not-main-head shape file page libraries) (check-component-not-root shape file page) - (check-valid-touched shape file page) + #_(check-valid-touched shape file page) ;; We can have situations where the nested copy and the ancestor copy come from different libraries and some of them have been dettached ;; so we only validate the shape-ref if the ancestor is from a valid library (when library-exists @@ -418,7 +418,7 @@ (check-component-not-root shape file page) (check-component-ref shape file page libraries) (check-empty-swap-slot shape file page) - (check-valid-touched shape file page) + #_(check-valid-touched shape file page) (run! #(check-shape % file page libraries :context :copy-any) (:shapes shape))) (defn- check-shape-not-component From c62fadac4755e5e0b8cd0a4473e430621dc57697 Mon Sep 17 00:00:00 2001 From: Aitor Moreno Date: Tue, 16 Sep 2025 11:36:21 +0200 Subject: [PATCH 3/3] :bug: Fix fast move with distance (#7302) * :bug: Fix fast move with distance * :paperclip: Remove duplicated shourtcuts --------- Co-authored-by: Andrey Antukh --- frontend/src/app/main/data/workspace/shortcuts.cljs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/main/data/workspace/shortcuts.cljs b/frontend/src/app/main/data/workspace/shortcuts.cljs index c1741df475..b36a28006b 100644 --- a/frontend/src/app/main/data/workspace/shortcuts.cljs +++ b/frontend/src/app/main/data/workspace/shortcuts.cljs @@ -213,22 +213,22 @@ :fn #(emit-when-no-readonly (dw/vertical-order-selected :bottom))} :move-fast-up {:tooltip (ds/shift ds/up-arrow) - :command ["shift+up"] + :command ["shift+up" "shift+alt+up"] :subsections [:modify-layers] :fn #(emit-when-no-readonly (dwt/move-selected :up true))} :move-fast-down {:tooltip (ds/shift ds/down-arrow) - :command ["shift+down"] + :command ["shift+down" "shift+alt+down"] :subsections [:modify-layers] :fn #(emit-when-no-readonly (dwt/move-selected :down true))} :move-fast-right {:tooltip (ds/shift ds/right-arrow) - :command ["shift+right" "shift+alt+right" "alt+shift+right"] + :command ["shift+right" "shift+alt+right"] :subsections [:modify-layers] :fn #(emit-when-no-readonly (dwt/move-selected :right true))} :move-fast-left {:tooltip (ds/shift ds/left-arrow) - :command ["shift+left" "shift+alt+left" "alt+shift+left"] + :command ["shift+left" "shift+alt+left"] :subsections [:modify-layers] :fn #(emit-when-no-readonly (dwt/move-selected :left true))}