diff --git a/CHANGES.md b/CHANGES.md index 2ba82415be..59d7c4a77d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -35,7 +35,7 @@ - Fix problem in viewer with the back button [Taiga #10907](https://tree.taiga.io/project/penpot/issue/10907) ### :bug: Bugs fixed - +- Fix resize bar background on tokens panel [Taiga #10811](https://tree.taiga.io/project/penpot/issue/10811) - Fix shortcut for history version panel [Taiga #11006](https://tree.taiga.io/project/penpot/issue/11006) - Fix positioning of comment drafts when near the right / bottom edges of viewport [Taiga #10534](https://tree.taiga.io/project/penpot/issue/10534) - Fix path having a wrong selrect [Taiga #10257](https://tree.taiga.io/project/penpot/issue/10257) @@ -58,6 +58,7 @@ - Fix Out of Sync Token Value & Color Picker [Github #102](https://github.com/tokens-studio/penpot/issues/102) - Fix Color should preserve color space [Github #69](https://github.com/tokens-studio/penpot/issues/69) - Fix cannot rename Design Token Sets when group of same name exists [Taiga Issue #10773](https://tree.taiga.io/project/penpot/issue/10773) +- Fix problem when duplicating grid layout [Github #6391](https://github.com/penpot/penpot/issues/6391) ## 2.6.2 (Unreleased) diff --git a/backend/src/app/loggers/audit.clj b/backend/src/app/loggers/audit.clj index 88e506f225..20d300ea7f 100644 --- a/backend/src/app/loggers/audit.clj +++ b/backend/src/app/loggers/audit.clj @@ -108,6 +108,7 @@ [::ip-addr {:optional true} ::sm/text] [::props {:optional true} [:map-of :keyword :any]] [::context {:optional true} [:map-of :keyword :any]] + [::tracked-at {:optional true} ::sm/inst] [::webhooks/event? {:optional true} ::sm/boolean] [::webhooks/batch-timeout {:optional true} ::dt/duration] [::webhooks/batch-key {:optional true} @@ -118,12 +119,12 @@ (defn prepare-event [cfg mdata params result] - (let [resultm (meta result) - request (-> params meta ::http/request) - profile-id (or (::profile-id resultm) - (:profile-id result) - (::rpc/profile-id params) - uuid/zero) + (let [resultm (meta result) + request (-> params meta ::http/request) + profile-id (or (::profile-id resultm) + (:profile-id result) + (::rpc/profile-id params) + uuid/zero) session-id (get params ::rpc/external-session-id) event-origin (get params ::rpc/external-event-origin) @@ -135,14 +136,14 @@ (clean-props)) - token-id (::actoken/id request) - context (-> (::context resultm) - (assoc :external-session-id session-id) - (assoc :external-event-origin event-origin) - (assoc :access-token-id (some-> token-id str)) - (d/without-nils)) + token-id (::actoken/id request) + context (-> (::context resultm) + (assoc :external-session-id session-id) + (assoc :external-event-origin event-origin) + (assoc :access-token-id (some-> token-id str)) + (d/without-nils)) - ip-addr (inet/parse-request request)] + ip-addr (inet/parse-request request)] {::type (or (::type resultm) (::rpc/type cfg)) diff --git a/backend/src/app/loggers/webhooks.clj b/backend/src/app/loggers/webhooks.clj index 9d2892dd7d..1b8305504d 100644 --- a/backend/src/app/loggers/webhooks.clj +++ b/backend/src/app/loggers/webhooks.clj @@ -15,6 +15,7 @@ [app.config :as cf] [app.db :as db] [app.http.client :as http] + [app.loggers.audit :as audit] [app.util.time :as dt] [app.worker :as wrk] [clojure.data.json :as json] @@ -67,18 +68,27 @@ (defmethod ig/init-key ::process-event-handler [_ cfg] (fn [{:keys [props] :as task}] - (l/dbg :hint "process webhook event" :name (:name props)) - (when-let [items (lookup-webhooks cfg props)] - (l/trc :hint "webhooks found for event" :total (count items)) - (db/tx-run! cfg (fn [cfg] - (doseq [item items] - (wrk/submit! (-> cfg - (assoc ::wrk/task :run-webhook) - (assoc ::wrk/queue :webhooks) - (assoc ::wrk/max-retries 3) - (assoc ::wrk/params {:event props - :config item}))))))))) + (let [items (lookup-webhooks cfg props) + event {::audit/profile-id (:profile-id props) + ::audit/name "webhook" + ::audit/type "trigger" + ::audit/props {:name (get props :name) + :event-id (get props :id) + :total-affected (count items)}}] + + (audit/insert! cfg event) + + (when items + (l/trc :hint "webhooks found for event" :total (count items)) + (db/tx-run! cfg (fn [cfg] + (doseq [item items] + (wrk/submit! (-> cfg + (assoc ::wrk/task :run-webhook) + (assoc ::wrk/queue :webhooks) + (assoc ::wrk/max-retries 3) + (assoc ::wrk/params {:event props + :config item})))))))))) ;; --- RUN (declare interpret-exception) diff --git a/common/src/app/common/files/changes_builder.cljc b/common/src/app/common/files/changes_builder.cljc index 9028c04d97..0794a4efb5 100644 --- a/common/src/app/common/files/changes_builder.cljc +++ b/common/src/app/common/files/changes_builder.cljc @@ -1050,6 +1050,33 @@ :id id :delta delta}))) +(defn reorder-children + [changes id children] + (assert-page-id! changes) + (assert-objects! changes) + + (let [page-id (::page-id (meta changes)) + objects (lookup-objects changes) + shape (get objects id) + old-children (:shapes shape) + + redo-change + {:type :reorder-children + :parent-id (:id shape) + :page-id page-id + :shapes children} + + undo-change + {:type :reorder-children + :parent-id (:id shape) + :page-id page-id + :shapes old-children}] + + (-> changes + (update :redo-changes conj redo-change) + (update :undo-changes conj undo-change) + (apply-changes-local)))) + (defn reorder-grid-children [changes ids] (assert-page-id! changes) diff --git a/common/src/app/common/logic/libraries.cljc b/common/src/app/common/logic/libraries.cljc index 2566f51f27..0f45d32066 100644 --- a/common/src/app/common/logic/libraries.cljc +++ b/common/src/app/common/logic/libraries.cljc @@ -223,10 +223,12 @@ "Generate changes to create a new instance from a component." ([changes objects file-id component-id position page libraries] (generate-instantiate-component changes objects file-id component-id position page libraries nil nil nil {})) - - ([changes objects file-id component-id position page libraries old-id parent-id frame-id + ([changes objects file-id component-id position page libraries old-id parent-id frame-id params] + (generate-instantiate-component changes objects file-id component-id position page libraries old-id parent-id frame-id {} params)) + ([changes objects file-id component-id position page libraries old-id parent-id frame-id ids-map {:keys [force-frame?] :or {force-frame? false}}] + (let [component (ctf/get-component libraries file-id component-id) library (get libraries file-id) parent (when parent-id (get objects parent-id)) @@ -246,6 +248,9 @@ (:data library) position (cond-> {} + (contains? ids-map old-id) + (assoc :force-id (get ids-map old-id)) + force-frame? (assoc :force-frame-id frame-id))) @@ -267,8 +272,11 @@ (cond-> (pcb/add-object changes first-shape {:ignore-touched true}) (some? old-id) (pcb/amend-last-change #(assoc % :old-id old-id))) + duplicated-parent? + (->> ids-map vals (some #(= % (:parent-id first-shape)))) + changes - (if (ctl/grid-layout? objects (:parent-id first-shape)) + (if (and (ctl/grid-layout? objects (:parent-id first-shape)) (not duplicated-parent?)) (let [target-cell (-> position meta :cell) [row column] @@ -2028,17 +2036,26 @@ [changes library-data component-id library-id current-page objects] (let [{:keys [changes shape]} (prepare-restore-component changes library-data component-id current-page) parent-id (:parent-id shape) - objects (cond-> (assoc objects (:id shape) shape) - (not (nil? parent-id)) - (update-in [parent-id :shapes] - #(conj % (:id shape)))) + + insert-before? + (and (ctl/flex-layout? objects parent-id) + (not (ctl/reverse? objects parent-id))) + + objects + (-> objects + (assoc (:id shape) shape) + (cond-> (and (some? parent-id) insert-before?) + (update-in [parent-id :shapes] #(d/concat-vec [(:id shape)] %))) + (cond-> (and (some? parent-id) (not insert-before?)) + (update-in [parent-id :shapes] conj (:id shape)))) ;; Adds a resize-parents operation so the groups are updated. We add all the new objects new-objects-ids (->> changes :redo-changes (filter #(= (:type %) :add-obj)) (mapv :id)) changes (-> changes (pcb/with-objects objects) - (pcb/resize-parents new-objects-ids))] - + (pcb/resize-parents new-objects-ids) + ;; Fix the order of the children inside the parent + (pcb/reorder-children parent-id (get-in objects [parent-id :shapes])))] (assoc changes :file-id library-id))) (defn generate-detach-component @@ -2277,6 +2294,7 @@ main-id parent-id frame-id + ids-map {})))] changes)) diff --git a/frontend/src/app/main/ui/workspace/sidebar.scss b/frontend/src/app/main/ui/workspace/sidebar.scss index 3101f9d8c1..9dba378304 100644 --- a/frontend/src/app/main/ui/workspace/sidebar.scss +++ b/frontend/src/app/main/ui/workspace/sidebar.scss @@ -85,6 +85,7 @@ $width-settings-bar-max: $s-500; } .resize-area-horiz { + background-color: var(--panel-background-color); position: absolute; left: 0; width: 100%; diff --git a/frontend/src/app/main/ui/workspace/tokens/sidebar.scss b/frontend/src/app/main/ui/workspace/tokens/sidebar.scss index 61e51e48a2..02969a2ad1 100644 --- a/frontend/src/app/main/ui/workspace/tokens/sidebar.scss +++ b/frontend/src/app/main/ui/workspace/tokens/sidebar.scss @@ -193,12 +193,14 @@ } .resize-area-horiz { + background-color: var(--panel-background-color); position: absolute; left: 0; width: 100%; padding: $s-3 0 $s-1 0; height: $s-6; cursor: ns-resize; + z-index: 1; } .resize-handle-horiz {