mirror of
https://github.com/penpot/penpot.git
synced 2025-06-06 04:11:44 +02:00
Merge pull request #1867 from penpot/hirunatan-bugfixing
Hirunatan bugfixing
This commit is contained in:
commit
15a26d10f0
4 changed files with 9 additions and 25 deletions
|
@ -221,6 +221,8 @@
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [it state _]
|
(watch [it state _]
|
||||||
(let [data (get state :workspace-data)
|
(let [data (get state :workspace-data)
|
||||||
|
[path name] (cph/parse-path-name (:name typography))
|
||||||
|
typography (assoc typography :path path :name name)
|
||||||
changes (-> (pcb/empty-changes it)
|
changes (-> (pcb/empty-changes it)
|
||||||
(pcb/with-library-data data)
|
(pcb/with-library-data data)
|
||||||
(pcb/update-typography typography))]
|
(pcb/update-typography typography))]
|
||||||
|
|
|
@ -54,8 +54,8 @@
|
||||||
;; Subscribe to notifications of the subscription
|
;; Subscribe to notifications of the subscription
|
||||||
(->> stream
|
(->> stream
|
||||||
(rx/filter (ptk/type? ::dws/message))
|
(rx/filter (ptk/type? ::dws/message))
|
||||||
(rx/map deref)
|
(rx/map deref) ;; :library-change events occur in a different file, but need to be processed anyway
|
||||||
(rx/filter #(= subs-id (:subs-id %)))
|
(rx/filter #(or (= subs-id (:subs-id %)) (= (:type %) :library-change)))
|
||||||
(rx/map process-message))
|
(rx/map process-message))
|
||||||
|
|
||||||
;; On reconnect, send again the subscription messages
|
;; On reconnect, send again the subscription messages
|
||||||
|
|
|
@ -80,5 +80,6 @@
|
||||||
|
|
||||||
(when has-image?
|
(when has-image?
|
||||||
[:image {:xlinkHref (get embed uri uri)
|
[:image {:xlinkHref (get embed uri uri)
|
||||||
|
:preserveAspectRatio "none"
|
||||||
:width width
|
:width width
|
||||||
:height height}])]])])))))
|
:height height}])]])])))))
|
||||||
|
|
|
@ -462,21 +462,13 @@
|
||||||
name-input-ref (mf/use-ref)
|
name-input-ref (mf/use-ref)
|
||||||
on-change-ref (mf/use-ref nil)
|
on-change-ref (mf/use-ref nil)
|
||||||
|
|
||||||
name-ref (mf/use-ref (:name typography))
|
|
||||||
|
|
||||||
on-name-blur
|
on-name-blur
|
||||||
(mf/use-callback
|
(mf/use-callback
|
||||||
(mf/deps on-change)
|
(mf/deps on-change)
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(let [content (dom/get-target-val event)]
|
(let [name (dom/get-target-val event)]
|
||||||
(when-not (str/blank? content)
|
(when-not (str/blank? name)
|
||||||
(let [[path name] (cph/parse-path-name content)]
|
(on-change {:name name })))))]
|
||||||
(on-change {:name name :path path}))))))
|
|
||||||
|
|
||||||
on-name-change
|
|
||||||
(mf/use-callback
|
|
||||||
(fn [event]
|
|
||||||
(mf/set-ref-val! name-ref (dom/get-target-val event))))]
|
|
||||||
|
|
||||||
(mf/use-effect
|
(mf/use-effect
|
||||||
(mf/deps editing?)
|
(mf/deps editing?)
|
||||||
|
@ -498,16 +490,6 @@
|
||||||
(fn []
|
(fn []
|
||||||
(mf/set-ref-val! on-change-ref {:on-change on-change})))
|
(mf/set-ref-val! on-change-ref {:on-change on-change})))
|
||||||
|
|
||||||
(mf/use-effect
|
|
||||||
(fn []
|
|
||||||
(fn []
|
|
||||||
(let [content (mf/ref-val name-ref)]
|
|
||||||
;; On destroy we check if it changed
|
|
||||||
(when (and (some? content) (not= content (:name typography)))
|
|
||||||
(let [{:keys [on-change]} (mf/ref-val on-change-ref)
|
|
||||||
[path name] (cph/parse-path-name content)]
|
|
||||||
(on-change {:name name :path path})))))))
|
|
||||||
|
|
||||||
[:*
|
[:*
|
||||||
[:div.element-set-options-group.typography-entry
|
[:div.element-set-options-group.typography-entry
|
||||||
{:class (when selected? "selected")
|
{:class (when selected? "selected")
|
||||||
|
@ -582,8 +564,7 @@
|
||||||
{:type "text"
|
{:type "text"
|
||||||
:ref name-input-ref
|
:ref name-input-ref
|
||||||
:default-value (cph/merge-path-item (:path typography) (:name typography))
|
:default-value (cph/merge-path-item (:path typography) (:name typography))
|
||||||
:on-blur on-name-blur
|
:on-blur on-name-blur}]
|
||||||
:on-change on-name-change}]
|
|
||||||
|
|
||||||
[:div.element-set-actions-button
|
[:div.element-set-actions-button
|
||||||
{:on-click #(reset! open? false)}
|
{:on-click #(reset! open? false)}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue