Merge pull request #1867 from penpot/hirunatan-bugfixing

Hirunatan bugfixing
This commit is contained in:
Eva Marco 2022-05-06 13:09:44 +02:00 committed by GitHub
commit 15a26d10f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 25 deletions

View file

@ -221,6 +221,8 @@
ptk/WatchEvent
(watch [it state _]
(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)
(pcb/with-library-data data)
(pcb/update-typography typography))]

View file

@ -54,8 +54,8 @@
;; Subscribe to notifications of the subscription
(->> stream
(rx/filter (ptk/type? ::dws/message))
(rx/map deref)
(rx/filter #(= subs-id (:subs-id %)))
(rx/map deref) ;; :library-change events occur in a different file, but need to be processed anyway
(rx/filter #(or (= subs-id (:subs-id %)) (= (:type %) :library-change)))
(rx/map process-message))
;; On reconnect, send again the subscription messages

View file

@ -80,5 +80,6 @@
(when has-image?
[:image {:xlinkHref (get embed uri uri)
:preserveAspectRatio "none"
:width width
:height height}])]])])))))

View file

@ -462,21 +462,13 @@
name-input-ref (mf/use-ref)
on-change-ref (mf/use-ref nil)
name-ref (mf/use-ref (:name typography))
on-name-blur
(mf/use-callback
(mf/deps on-change)
(fn [event]
(let [content (dom/get-target-val event)]
(when-not (str/blank? content)
(let [[path name] (cph/parse-path-name content)]
(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))))]
(let [name (dom/get-target-val event)]
(when-not (str/blank? name)
(on-change {:name name })))))]
(mf/use-effect
(mf/deps editing?)
@ -498,16 +490,6 @@
(fn []
(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
{:class (when selected? "selected")
@ -582,8 +564,7 @@
{:type "text"
:ref name-input-ref
:default-value (cph/merge-path-item (:path typography) (:name typography))
:on-blur on-name-blur
:on-change on-name-change}]
:on-blur on-name-blur}]
[:div.element-set-actions-button
{:on-click #(reset! open? false)}