mirror of
https://github.com/penpot/penpot.git
synced 2025-01-08 16:00:19 -05:00
🐛 Fix export multiple images when only one of them has export settings
This commit is contained in:
parent
1b31a02c14
commit
db7c4a9265
2 changed files with 30 additions and 12 deletions
|
@ -87,6 +87,7 @@
|
|||
- Fix absolute positioned layouts not showing flex properties [Taiga #5630](https://tree.taiga.io/project/penpot/issue/5630)
|
||||
- Fix text gradient handlers [Taiga #4047](https://tree.taiga.io/project/penpot/issue/4047)
|
||||
- Fix when user deletes one file during import it is impossible to finish importing of second file [Taiga #5656](https://tree.taiga.io/project/penpot/issue/5656)
|
||||
- Fix export multiple images when only one of them has export settings [Taiga #5649](https://tree.taiga.io/project/penpot/issue/5649)
|
||||
|
||||
### :arrow_up: Deps updates
|
||||
|
||||
|
|
|
@ -31,9 +31,11 @@
|
|||
state (mf/deref refs/export)
|
||||
in-progress? (:in-progress state)
|
||||
|
||||
shapes-with-exports (->> (wsh/lookup-shapes @st/state ids)
|
||||
(filter #(pos? (count (:exports %)))))
|
||||
|
||||
sname (when (seqable? exports)
|
||||
(let [shapes (wsh/lookup-shapes @st/state ids)
|
||||
sname (-> shapes first :name)
|
||||
(let [sname (-> shapes-with-exports first :name)
|
||||
suffix (-> exports first :suffix)]
|
||||
(cond-> sname
|
||||
(and (= 1 (count exports)) (some? suffix))
|
||||
|
@ -50,7 +52,22 @@
|
|||
(fn [event]
|
||||
(dom/prevent-default event)
|
||||
(if (= :multiple type)
|
||||
(st/emit! (de/show-workspace-export-dialog {:selected (reverse ids)}))
|
||||
;; I can select multiple shapes all of them with no export settings and one of them with only one
|
||||
;; In that situation we must export it directly
|
||||
(if (and (= 1 (count shapes-with-exports)) (= 1 (-> shapes-with-exports first :exports count)))
|
||||
(let [shape (-> shapes-with-exports first)
|
||||
export (-> shape :exports first)
|
||||
sname (:name shape)
|
||||
suffix (:suffix export)
|
||||
defaults {:page-id page-id
|
||||
:file-id file-id
|
||||
:name sname
|
||||
:object-id (:id (first shapes-with-exports))}]
|
||||
(cond-> sname
|
||||
(some? suffix)
|
||||
(str suffix))
|
||||
(st/emit! (de/request-simple-export {:export (merge export defaults)})))
|
||||
(st/emit! (de/show-workspace-export-dialog {:selected (reverse ids)})))
|
||||
|
||||
;; In other all cases we only allowed to have a single
|
||||
;; shape-id because multiple shape-ids are handled
|
||||
|
@ -182,4 +199,4 @@
|
|||
:disabled in-progress?}
|
||||
(if in-progress?
|
||||
(tr "workspace.options.exporting-object")
|
||||
(tr "workspace.options.export-object" (c (count ids))))])]))
|
||||
(tr "workspace.options.export-object" (c (count shapes-with-exports))))])]))
|
||||
|
|
Loading…
Reference in a new issue