mirror of
https://github.com/penpot/penpot.git
synced 2026-09-07 12:40:12 +00:00
🐛 Fix color picker
This commit is contained in:
parent
b37acf75ce
commit
5375fbf59e
@ -32,16 +32,18 @@
|
|||||||
[svg-node]
|
[svg-node]
|
||||||
(let [image-nodes (dom/query-all svg-node "image:not([href^=data])")
|
(let [image-nodes (dom/query-all svg-node "image:not([href^=data])")
|
||||||
noop-fn (constantly nil)]
|
noop-fn (constantly nil)]
|
||||||
(->> (rx/from image-nodes)
|
(if (empty? image-nodes)
|
||||||
(rx/mapcat
|
(rx/of nil)
|
||||||
(fn [image]
|
(->> (rx/from image-nodes)
|
||||||
(let [href (dom/get-attribute image "href")]
|
(rx/mapcat
|
||||||
(->> (http/fetch {:method :get :uri href})
|
(fn [image]
|
||||||
(rx/mapcat (fn [response] (.blob ^js response)))
|
(let [href (dom/get-attribute image "href")]
|
||||||
(rx/mapcat wapi/read-file-as-data-url)
|
(->> (http/fetch {:method :get :uri href})
|
||||||
(rx/tap (fn [data]
|
(rx/mapcat (fn [response] (.blob ^js response)))
|
||||||
(dom/set-attribute! image "href" data)))
|
(rx/mapcat wapi/read-file-as-data-url)
|
||||||
(rx/reduce noop-fn))))))))
|
(rx/tap (fn [data]
|
||||||
|
(dom/set-attribute! image "href" data)))
|
||||||
|
(rx/reduce noop-fn)))))))))
|
||||||
|
|
||||||
(defn- svg-as-data-url
|
(defn- svg-as-data-url
|
||||||
"Transforms SVG as data-url resolving any blob, http or https url to
|
"Transforms SVG as data-url resolving any blob, http or https url to
|
||||||
@ -95,7 +97,7 @@
|
|||||||
canvas-ref (mf/use-ref nil)
|
canvas-ref (mf/use-ref nil)
|
||||||
img-ref (mf/use-ref nil)
|
img-ref (mf/use-ref nil)
|
||||||
|
|
||||||
update-str (rx/subject)
|
update-str (rx/subject)
|
||||||
|
|
||||||
handle-keydown
|
handle-keydown
|
||||||
(mf/use-callback
|
(mf/use-callback
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user