mirror of
https://github.com/penpot/penpot.git
synced 2025-07-15 21:45:14 +02:00
Merge remote-tracking branch 'origin/staging' into develop
This commit is contained in:
commit
045e83e871
16 changed files with 165 additions and 28 deletions
|
@ -1124,6 +1124,14 @@
|
|||
(update [_ state]
|
||||
(assoc-in state [:workspace-assets :open-status file-id section] open?))))
|
||||
|
||||
(defn clear-assets-section-open
|
||||
[]
|
||||
(ptk/reify ::clear-assets-section-open
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
(assoc-in state [:workspace-assets :open-status] {}))))
|
||||
|
||||
|
||||
(defn set-assets-group-open
|
||||
[file-id section path open?]
|
||||
(ptk/reify ::set-assets-group-open
|
||||
|
|
|
@ -609,9 +609,13 @@
|
|||
(assoc :type :color))))))))
|
||||
ptk/WatchEvent
|
||||
(watch [_ state _]
|
||||
;; Type can be null, because the colorpicker can be closed while a color image finish its upload
|
||||
(when (and add-recent? (some? (:type state)))
|
||||
(let [formated-color (get-color-from-colorpicker-state (:colorpicker state))]
|
||||
(let [selected-type (-> state
|
||||
:colorpicker
|
||||
:type)
|
||||
formated-color (get-color-from-colorpicker-state (:colorpicker state))
|
||||
;; Type is set to color on closing the colorpicker, but we can can close it while still uploading an image fill
|
||||
ignore-color? (and (= selected-type :color) (nil? (:color formated-color)))]
|
||||
(when (and add-recent? (not ignore-color?))
|
||||
(rx/of (dwl/add-recent-color formated-color)))))))
|
||||
|
||||
(defn update-colorpicker-gradient
|
||||
|
|
|
@ -615,7 +615,6 @@
|
|||
(let [page-id (:current-page-id state)
|
||||
objects (wsh/lookup-page-objects state page-id)
|
||||
file (wsh/get-local-file state)
|
||||
container (cfh/get-container file :page page-id)
|
||||
libraries (wsh/get-libraries state)
|
||||
selected (->> state
|
||||
(wsh/lookup-selected)
|
||||
|
@ -627,7 +626,7 @@
|
|||
changes (when can-detach?
|
||||
(reduce
|
||||
(fn [changes id]
|
||||
(cll/generate-detach-instance changes container libraries id))
|
||||
(cll/generate-detach-component changes id file page-id libraries))
|
||||
(pcb/empty-changes it)
|
||||
selected))]
|
||||
|
||||
|
|
|
@ -489,7 +489,7 @@
|
|||
|
||||
:else
|
||||
[:& context-notification
|
||||
{:type :success
|
||||
{:type (if (zero? success-num) :warning :success)
|
||||
:content (tr "dashboard.import.import-message" (i18n/c success-num))}]))
|
||||
|
||||
(for [entry entries]
|
||||
|
|
|
@ -9,8 +9,10 @@
|
|||
(:require
|
||||
[app.common.data.macros :as dm]
|
||||
[app.main.data.modal :as modal]
|
||||
[app.main.data.workspace :as dw]
|
||||
[app.main.data.workspace.assets :as dwa]
|
||||
[app.main.refs :as refs]
|
||||
[app.main.store :as st]
|
||||
[app.main.ui.components.context-menu-a11y :refer [context-menu-a11y]]
|
||||
[app.main.ui.components.search-bar :refer [search-bar]]
|
||||
[app.main.ui.context :as ctx]
|
||||
|
@ -103,6 +105,7 @@
|
|||
on-search-term-change
|
||||
(mf/use-fn
|
||||
(fn [event]
|
||||
(st/emit! (dw/clear-assets-section-open))
|
||||
(swap! filters* assoc :term event)))
|
||||
|
||||
on-section-filter-change
|
||||
|
@ -112,6 +115,7 @@
|
|||
(dom/get-value))
|
||||
(as-> (dom/get-current-target event) $
|
||||
(dom/get-attribute $ "data-testid")))]
|
||||
(st/emit! (dw/clear-assets-section-open))
|
||||
(swap! filters* assoc :section value :open-menu false))))
|
||||
|
||||
show-libraries-dialog
|
||||
|
|
|
@ -192,8 +192,10 @@
|
|||
on-drag-start do-rename cancel-rename on-rename-group on-group on-ungroup on-context-menu
|
||||
selected-full local]}]
|
||||
|
||||
(let [group-open? (or ^boolean force-open?
|
||||
^boolean (get open-groups prefix (if (= prefix "") true false)))
|
||||
(let [group-open? (if (false? (get open-groups prefix)) ;; if the user has closed it specifically, respect that
|
||||
false
|
||||
(or ^boolean force-open?
|
||||
^boolean (get open-groups prefix (if (= prefix "") true false))))
|
||||
dragging* (mf/use-state false)
|
||||
dragging? (deref dragging*)
|
||||
|
||||
|
|
|
@ -318,6 +318,7 @@
|
|||
(and has-term?
|
||||
(some pos? (map count [filtered-components filtered-colors filtered-media filtered-typographies]))
|
||||
(some #(> 60 (count %)) [filtered-components filtered-colors filtered-media filtered-typographies]))))
|
||||
|
||||
(mf/defc file-library
|
||||
{::mf/wrap-props false}
|
||||
[{:keys [file local? default-open? filters]}]
|
||||
|
@ -333,8 +334,10 @@
|
|||
open-status (mf/deref open-status-ref)
|
||||
force-open-lib? (force-lib-open? file-id filters)
|
||||
|
||||
open? (or force-open-lib?
|
||||
(d/nilv (:library open-status) default-open?))
|
||||
open? (if (false? (:library open-status)) ;; if the user has closed it specifically, respect that
|
||||
false
|
||||
(or force-open-lib?
|
||||
(d/nilv (:library open-status) default-open?)))
|
||||
|
||||
unselect-all
|
||||
(mf/use-fn
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
[app.common.svg.path.subpath :refer [pt=]]
|
||||
[app.util.array :as arr]))
|
||||
|
||||
;; TODO: move to common
|
||||
|
||||
(def path-precision 3)
|
||||
|
||||
(defn- join-params
|
||||
|
|
|
@ -223,6 +223,32 @@
|
|||
(uuid? (get item :typography-ref-file))
|
||||
(d/update-when :typography-ref-file resolve)))))))
|
||||
|
||||
(defn resolve-fills-content
|
||||
[fills context]
|
||||
(let [resolve (:resolve context)]
|
||||
(->> fills
|
||||
(mapv
|
||||
(fn [fill]
|
||||
(cond-> fill
|
||||
(uuid? (get fill :fill-color-ref-id))
|
||||
(d/update-when :fill-color-ref-id resolve)
|
||||
|
||||
(uuid? (get fill :fill-color-ref-file))
|
||||
(d/update-when :fill-color-ref-file resolve)))))))
|
||||
|
||||
(defn resolve-strokes-content
|
||||
[fills context]
|
||||
(let [resolve (:resolve context)]
|
||||
(->> fills
|
||||
(mapv
|
||||
(fn [fill]
|
||||
(cond-> fill
|
||||
(uuid? (get fill :stroke-color-ref-id))
|
||||
(d/update-when :stroke-color-ref-id resolve)
|
||||
|
||||
(uuid? (get fill :stroke-color-ref-file))
|
||||
(d/update-when :stroke-color-ref-file resolve)))))))
|
||||
|
||||
(defn resolve-data-ids
|
||||
[data type context]
|
||||
(let [resolve (:resolve context)]
|
||||
|
@ -238,6 +264,12 @@
|
|||
(cond-> (= type :text)
|
||||
(d/update-when :content resolve-text-content context))
|
||||
|
||||
(cond-> (:fills data)
|
||||
(d/update-when :fills resolve-fills-content context))
|
||||
|
||||
(cond-> (:strokes data)
|
||||
(d/update-when :strokes resolve-strokes-content context))
|
||||
|
||||
(cond-> (and (= type :frame) (= :grid (:layout data)))
|
||||
(update
|
||||
:layout-grid-cells
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue