mirror of
https://github.com/penpot/penpot.git
synced 2025-02-13 02:28:18 -05:00
commit
1a6a6e9367
7 changed files with 68 additions and 22 deletions
|
@ -1521,11 +1521,26 @@
|
||||||
|
|
||||||
(defn- update-flex-child-copy-attrs
|
(defn- update-flex-child-copy-attrs
|
||||||
"Synchronizes the attributes inside the flex-child items (main->copy)"
|
"Synchronizes the attributes inside the flex-child items (main->copy)"
|
||||||
[changes _shape-main shape-copy main-container main-component copy-container omit-touched?]
|
[changes shape-main shape-copy main-container main-component copy-container omit-touched?]
|
||||||
|
|
||||||
(let [new-changes
|
(let [new-changes
|
||||||
(-> (pcb/empty-changes)
|
(-> (pcb/empty-changes)
|
||||||
(pcb/with-container copy-container)
|
(pcb/with-container copy-container)
|
||||||
(pcb/with-objects (:objects copy-container))
|
(pcb/with-objects (:objects copy-container))
|
||||||
|
|
||||||
|
;; The layout-item-sizing needs to be update when the parent is auto or fix
|
||||||
|
(pcb/update-shapes
|
||||||
|
[(:id shape-copy)]
|
||||||
|
(fn [shape-copy]
|
||||||
|
(cond-> shape-copy
|
||||||
|
(contains? #{:auto :fix} (:layout-item-h-sizing shape-main))
|
||||||
|
(propagate-attrs shape-main #{:layout-item-h-sizing} omit-touched?)
|
||||||
|
|
||||||
|
(contains? #{:auto :fix} (:layout-item-h-sizing shape-main))
|
||||||
|
(propagate-attrs shape-main #{:layout-item-v-sizing} omit-touched?)))
|
||||||
|
{:ignore-touched true})
|
||||||
|
|
||||||
|
;; Update the child flex properties from the parent
|
||||||
(pcb/update-shapes
|
(pcb/update-shapes
|
||||||
(:shapes shape-copy)
|
(:shapes shape-copy)
|
||||||
(fn [child-copy]
|
(fn [child-copy]
|
||||||
|
@ -1542,6 +1557,20 @@
|
||||||
(-> (pcb/empty-changes)
|
(-> (pcb/empty-changes)
|
||||||
(pcb/with-page main-container)
|
(pcb/with-page main-container)
|
||||||
(pcb/with-objects (:objects main-container))
|
(pcb/with-objects (:objects main-container))
|
||||||
|
|
||||||
|
;; The layout-item-sizing needs to be update when the parent is auto or fix
|
||||||
|
(pcb/update-shapes
|
||||||
|
[(:id shape-main)]
|
||||||
|
(fn [shape-main]
|
||||||
|
(cond-> shape-main
|
||||||
|
(contains? #{:auto :fix} (:layout-item-h-sizing shape-copy))
|
||||||
|
(propagate-attrs shape-copy #{:layout-item-h-sizing} omit-touched?)
|
||||||
|
|
||||||
|
(contains? #{:auto :fix} (:layout-item-h-sizing shape-copy))
|
||||||
|
(propagate-attrs shape-copy #{:layout-item-v-sizing} omit-touched?)))
|
||||||
|
{:ignore-touched true})
|
||||||
|
|
||||||
|
;; Updates the children properties from the parent
|
||||||
(pcb/update-shapes
|
(pcb/update-shapes
|
||||||
(:shapes shape-main)
|
(:shapes shape-main)
|
||||||
(fn [child-main]
|
(fn [child-main]
|
||||||
|
@ -1620,4 +1649,3 @@
|
||||||
(if (cfh/page? container)
|
(if (cfh/page? container)
|
||||||
(assoc change :page-id (:id container))
|
(assoc change :page-id (:id container))
|
||||||
(assoc change :component-id (:id container))))
|
(assoc change :component-id (:id container))))
|
||||||
|
|
||||||
|
|
|
@ -196,6 +196,7 @@
|
||||||
position: relative;
|
position: relative;
|
||||||
.text {
|
.text {
|
||||||
@include bodySmallTypography;
|
@include bodySmallTypography;
|
||||||
|
white-space: pre;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,7 +152,7 @@
|
||||||
|
|
||||||
handle-key-down
|
handle-key-down
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps set-delta apply-value update-input)
|
(mf/deps set-delta apply-value update-input parse-value)
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(mf/set-ref-val! dirty-ref true)
|
(mf/set-ref-val! dirty-ref true)
|
||||||
(let [up? (kbd/up-arrow? event)
|
(let [up? (kbd/up-arrow? event)
|
||||||
|
@ -162,19 +162,13 @@
|
||||||
node (mf/ref-val ref)]
|
node (mf/ref-val ref)]
|
||||||
(when (or up? down?)
|
(when (or up? down?)
|
||||||
(set-delta event up? down?))
|
(set-delta event up? down?))
|
||||||
|
(reset! last-value* (parse-value))
|
||||||
(when enter?
|
(when enter?
|
||||||
(dom/blur! node))
|
(dom/blur! node))
|
||||||
(when esc?
|
(when esc?
|
||||||
(update-input value-str)
|
(update-input value-str)
|
||||||
(dom/blur! node)))))
|
(dom/blur! node)))))
|
||||||
|
|
||||||
handle-key-up
|
|
||||||
(mf/use-fn
|
|
||||||
(mf/deps parse-value)
|
|
||||||
(fn []
|
|
||||||
;; Store the last value inputed
|
|
||||||
(reset! last-value* (parse-value))))
|
|
||||||
|
|
||||||
handle-mouse-wheel
|
handle-mouse-wheel
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps set-delta)
|
(mf/deps set-delta)
|
||||||
|
@ -231,7 +225,6 @@
|
||||||
(obj/set! "defaultValue" (fmt/format-number value))
|
(obj/set! "defaultValue" (fmt/format-number value))
|
||||||
(obj/set! "title" title)
|
(obj/set! "title" title)
|
||||||
(obj/set! "onKeyDown" handle-key-down)
|
(obj/set! "onKeyDown" handle-key-down)
|
||||||
(obj/set! "onKeyUp" handle-key-up)
|
|
||||||
(obj/set! "onBlur" handle-blur)
|
(obj/set! "onBlur" handle-blur)
|
||||||
(obj/set! "onFocus" handle-focus))]
|
(obj/set! "onFocus" handle-focus))]
|
||||||
|
|
||||||
|
|
|
@ -345,18 +345,21 @@
|
||||||
edition* (mf/use-state nil)
|
edition* (mf/use-state nil)
|
||||||
edition (deref edition*)
|
edition (deref edition*)
|
||||||
|
|
||||||
|
template-finished* (mf/use-state nil)
|
||||||
|
template-finished (deref template-finished*)
|
||||||
|
|
||||||
on-template-cloned-success
|
on-template-cloned-success
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(fn []
|
(fn []
|
||||||
(swap! status* (constantly :importing))
|
(reset! status* :importing)
|
||||||
;; (swap! state assoc :status :importing :importing-templates 0)
|
(reset! template-finished* true)
|
||||||
(st/emit! (dd/fetch-recent-files))))
|
(st/emit! (dd/fetch-recent-files))))
|
||||||
|
|
||||||
on-template-cloned-error
|
on-template-cloned-error
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(fn [cause]
|
(fn [cause]
|
||||||
(swap! status* (constantly :error))
|
(reset! status* :error)
|
||||||
;; (swap! state assoc :status :error :importing-templates 0)
|
(reset! template-finished* true)
|
||||||
(errors/print-error! cause)
|
(errors/print-error! cause)
|
||||||
(rx/of (modal/hide)
|
(rx/of (modal/hide)
|
||||||
(msg/error (tr "dashboard.libraries-and-templates.import-error")))))
|
(msg/error (tr "dashboard.libraries-and-templates.import-error")))))
|
||||||
|
@ -434,15 +437,29 @@
|
||||||
1
|
1
|
||||||
(count (filterv has-status-success? entries)))
|
(count (filterv has-status-success? entries)))
|
||||||
|
|
||||||
errors? (or (some has-status-error? entries)
|
errors? (if (some? template)
|
||||||
(zero? (count entries)))
|
(= status :error)
|
||||||
|
(or (some has-status-error? entries)
|
||||||
|
(zero? (count entries))))
|
||||||
|
|
||||||
pending-analysis? (some has-status-analyzing? entries)
|
pending-analysis? (some has-status-analyzing? entries)
|
||||||
pending-import? (pos? num-importing)
|
pending-import? (and (or (nil? template)
|
||||||
valid-all-entries? (or (some? template)
|
(not template-finished))
|
||||||
(not (some has-status-analyze-error? entries)))]
|
(pos? num-importing))
|
||||||
|
|
||||||
|
valid-all-entries? (or (some? template)
|
||||||
|
(not (some has-status-analyze-error? entries)))
|
||||||
|
|
||||||
|
template-status
|
||||||
|
(cond
|
||||||
|
(and (= :importing status) pending-import?)
|
||||||
|
:importing
|
||||||
|
|
||||||
|
(and (= :importing status) (not ^boolean pending-import?))
|
||||||
|
:import-finish
|
||||||
|
|
||||||
|
:else
|
||||||
|
:ready)]
|
||||||
|
|
||||||
;; Run analyze operation on component mount
|
;; Run analyze operation on component mount
|
||||||
(mf/with-effect []
|
(mf/with-effect []
|
||||||
|
@ -486,7 +503,7 @@
|
||||||
:can-be-deleted (> (count entries) 1)}])
|
:can-be-deleted (> (count entries) 1)}])
|
||||||
|
|
||||||
(when (some? template)
|
(when (some? template)
|
||||||
[:& import-entry {:entry (assoc template :status :ready)
|
[:& import-entry {:entry (assoc template :status template-status)
|
||||||
:can-be-deleted false}])]
|
:can-be-deleted false}])]
|
||||||
|
|
||||||
[:div {:class (stl/css :modal-footer)}
|
[:div {:class (stl/css :modal-footer)}
|
||||||
|
|
|
@ -480,6 +480,7 @@
|
||||||
[:button {:class (stl/css-case
|
[:button {:class (stl/css-case
|
||||||
:padding-toggle true
|
:padding-toggle true
|
||||||
:selected (= type :multiple))
|
:selected (= type :multiple))
|
||||||
|
:title (tr "workspace.layout_grid.editor.padding.expand")
|
||||||
:data-type (d/name type)
|
:data-type (d/name type)
|
||||||
:on-click on-type-change'}
|
:on-click on-type-change'}
|
||||||
i/padding-extended]]))
|
i/padding-extended]]))
|
||||||
|
|
|
@ -3520,6 +3520,9 @@ msgstr "Edit grid"
|
||||||
msgid "workspace.layout_grid.editor.options.exit"
|
msgid "workspace.layout_grid.editor.options.exit"
|
||||||
msgstr "Exit"
|
msgstr "Exit"
|
||||||
|
|
||||||
|
msgid "workspace.layout_grid.editor.padding.expand"
|
||||||
|
msgstr "Show 4 sided padding options"
|
||||||
|
|
||||||
#: src/app/main/ui/workspace/libraries.cljs
|
#: src/app/main/ui/workspace/libraries.cljs
|
||||||
msgid "workspace.libraries.add"
|
msgid "workspace.libraries.add"
|
||||||
msgstr "Add"
|
msgstr "Add"
|
||||||
|
|
|
@ -3582,6 +3582,9 @@ msgstr "Editar rejilla"
|
||||||
msgid "workspace.layout_grid.editor.options.exit"
|
msgid "workspace.layout_grid.editor.options.exit"
|
||||||
msgstr "Salir"
|
msgstr "Salir"
|
||||||
|
|
||||||
|
msgid "workspace.layout_grid.editor.padding.expand"
|
||||||
|
msgstr "Mostrar el padding a 4 lados"
|
||||||
|
|
||||||
#: src/app/main/ui/workspace/libraries.cljs
|
#: src/app/main/ui/workspace/libraries.cljs
|
||||||
msgid "workspace.libraries.add"
|
msgid "workspace.libraries.add"
|
||||||
msgstr "Añadir"
|
msgstr "Añadir"
|
||||||
|
|
Loading…
Add table
Reference in a new issue