mirror of
https://github.com/penpot/penpot.git
synced 2025-03-15 01:01:30 -05:00
Fix image uploading from workspace.
This commit is contained in:
parent
8697df75c1
commit
1954aebb48
1 changed files with 12 additions and 10 deletions
|
@ -2,24 +2,24 @@
|
||||||
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
;;
|
;;
|
||||||
;; Copyright (c) 2015-2016 Andrey Antukh <niwi@niwi.nz>
|
;; Copyright (c) 2015-2017 Andrey Antukh <niwi@niwi.nz>
|
||||||
;; Copyright (c) 2015-2016 Juan de la Cruz <delacruzgarciajuan@gmail.com>
|
;; Copyright (c) 2015-2017 Juan de la Cruz <delacruzgarciajuan@gmail.com>
|
||||||
|
|
||||||
(ns uxbox.main.ui.workspace.images
|
(ns uxbox.main.ui.workspace.images
|
||||||
(:require [lentes.core :as l]
|
(:require [lentes.core :as l]
|
||||||
[uxbox.util.i18n :as t :refer (tr)]
|
[uxbox.util.i18n :as t :refer [tr]]
|
||||||
[potok.core :as ptk]
|
[potok.core :as ptk]
|
||||||
[uxbox.util.mixins :as mx :include-macros true]
|
[uxbox.builtins.icons :as i]
|
||||||
[uxbox.util.data :as data :refer (read-string)]
|
|
||||||
[uxbox.util.dom :as dom]
|
|
||||||
[uxbox.main.store :as st]
|
[uxbox.main.store :as st]
|
||||||
[uxbox.main.data.lightbox :as udl]
|
[uxbox.main.data.lightbox :as udl]
|
||||||
[uxbox.main.data.images :as udi]
|
[uxbox.main.data.images :as udi]
|
||||||
[uxbox.main.data.workspace :as udw]
|
[uxbox.main.data.workspace :as udw]
|
||||||
[uxbox.main.data.shapes :as uds]
|
[uxbox.main.data.shapes :as uds]
|
||||||
[uxbox.builtins.icons :as i]
|
[uxbox.main.ui.lightbox :as lbx]
|
||||||
[uxbox.main.ui.lightbox :as lbx]))
|
[uxbox.util.data :refer [read-string jscoll->vec]]
|
||||||
|
[uxbox.util.dom :as dom]
|
||||||
|
[uxbox.util.mixins :as mx :include-macros true]
|
||||||
|
[uxbox.util.uuid :as uuid]))
|
||||||
|
|
||||||
;; --- Refs
|
;; --- Refs
|
||||||
|
|
||||||
|
@ -51,13 +51,15 @@
|
||||||
(let [{:keys [id name width height]} image
|
(let [{:keys [id name width height]} image
|
||||||
shape {:type :image
|
shape {:type :image
|
||||||
:name name
|
:name name
|
||||||
|
:id (uuid/random)
|
||||||
:metadata {:width width
|
:metadata {:width width
|
||||||
:height height}
|
:height height}
|
||||||
:image id}]
|
:image id}]
|
||||||
(st/emit! (udw/select-for-drawing shape))
|
(st/emit! (udw/select-for-drawing shape))
|
||||||
(udl/close!)))
|
(udl/close!)))
|
||||||
(on-files-selected [event]
|
(on-files-selected [event]
|
||||||
(let [files (dom/get-event-files event)]
|
(let [files (dom/get-event-files event)
|
||||||
|
files (jscoll->vec files)]
|
||||||
(st/emit! (udi/create-images nil files on-uploaded))))
|
(st/emit! (udi/create-images nil files on-uploaded))))
|
||||||
(on-select-from-library [event]
|
(on-select-from-library [event]
|
||||||
(dom/prevent-default event)
|
(dom/prevent-default event)
|
||||||
|
|
Loading…
Add table
Reference in a new issue