0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-08 16:18:11 -05:00

Merge pull request #4249 from penpot/alotor-bugfixing-26

Bugfixes
This commit is contained in:
Alejandro 2024-03-12 09:54:21 +01:00 committed by GitHub
commit 1a6a6e9367
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 68 additions and 22 deletions

View file

@ -1521,11 +1521,26 @@
(defn- update-flex-child-copy-attrs
"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
(-> (pcb/empty-changes)
(pcb/with-container 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
(:shapes shape-copy)
(fn [child-copy]
@ -1542,6 +1557,20 @@
(-> (pcb/empty-changes)
(pcb/with-page 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
(:shapes shape-main)
(fn [child-main]
@ -1620,4 +1649,3 @@
(if (cfh/page? container)
(assoc change :page-id (:id container))
(assoc change :component-id (:id container))))

View file

@ -196,6 +196,7 @@
position: relative;
.text {
@include bodySmallTypography;
white-space: pre;
}
}
}

View file

@ -152,7 +152,7 @@
handle-key-down
(mf/use-fn
(mf/deps set-delta apply-value update-input)
(mf/deps set-delta apply-value update-input parse-value)
(fn [event]
(mf/set-ref-val! dirty-ref true)
(let [up? (kbd/up-arrow? event)
@ -162,19 +162,13 @@
node (mf/ref-val ref)]
(when (or up? down?)
(set-delta event up? down?))
(reset! last-value* (parse-value))
(when enter?
(dom/blur! node))
(when esc?
(update-input value-str)
(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
(mf/use-fn
(mf/deps set-delta)
@ -231,7 +225,6 @@
(obj/set! "defaultValue" (fmt/format-number value))
(obj/set! "title" title)
(obj/set! "onKeyDown" handle-key-down)
(obj/set! "onKeyUp" handle-key-up)
(obj/set! "onBlur" handle-blur)
(obj/set! "onFocus" handle-focus))]

View file

@ -345,18 +345,21 @@
edition* (mf/use-state nil)
edition (deref edition*)
template-finished* (mf/use-state nil)
template-finished (deref template-finished*)
on-template-cloned-success
(mf/use-fn
(fn []
(swap! status* (constantly :importing))
;; (swap! state assoc :status :importing :importing-templates 0)
(reset! status* :importing)
(reset! template-finished* true)
(st/emit! (dd/fetch-recent-files))))
on-template-cloned-error
(mf/use-fn
(fn [cause]
(swap! status* (constantly :error))
;; (swap! state assoc :status :error :importing-templates 0)
(reset! status* :error)
(reset! template-finished* true)
(errors/print-error! cause)
(rx/of (modal/hide)
(msg/error (tr "dashboard.libraries-and-templates.import-error")))))
@ -434,15 +437,29 @@
1
(count (filterv has-status-success? entries)))
errors? (or (some has-status-error? entries)
(zero? (count entries)))
errors? (if (some? template)
(= status :error)
(or (some has-status-error? entries)
(zero? (count entries))))
pending-analysis? (some has-status-analyzing? entries)
pending-import? (pos? num-importing)
valid-all-entries? (or (some? template)
(not (some has-status-analyze-error? entries)))]
pending-import? (and (or (nil? template)
(not template-finished))
(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
(mf/with-effect []
@ -486,7 +503,7 @@
:can-be-deleted (> (count entries) 1)}])
(when (some? template)
[:& import-entry {:entry (assoc template :status :ready)
[:& import-entry {:entry (assoc template :status template-status)
:can-be-deleted false}])]
[:div {:class (stl/css :modal-footer)}

View file

@ -480,6 +480,7 @@
[:button {:class (stl/css-case
:padding-toggle true
:selected (= type :multiple))
:title (tr "workspace.layout_grid.editor.padding.expand")
:data-type (d/name type)
:on-click on-type-change'}
i/padding-extended]]))

View file

@ -3520,6 +3520,9 @@ msgstr "Edit grid"
msgid "workspace.layout_grid.editor.options.exit"
msgstr "Exit"
msgid "workspace.layout_grid.editor.padding.expand"
msgstr "Show 4 sided padding options"
#: src/app/main/ui/workspace/libraries.cljs
msgid "workspace.libraries.add"
msgstr "Add"

View file

@ -3582,6 +3582,9 @@ msgstr "Editar rejilla"
msgid "workspace.layout_grid.editor.options.exit"
msgstr "Salir"
msgid "workspace.layout_grid.editor.padding.expand"
msgstr "Mostrar el padding a 4 lados"
#: src/app/main/ui/workspace/libraries.cljs
msgid "workspace.libraries.add"
msgstr "Añadir"