mirror of
https://github.com/penpot/penpot.git
synced 2025-08-07 14:38:33 +02:00
Revert "✨ Add support for svg optimizations on workspace svg import"
This reverts commit b92fcca17c
.
This commit is contained in:
parent
9d090ad3d9
commit
11df5ec15e
1 changed files with 7 additions and 28 deletions
|
@ -12,12 +12,11 @@
|
||||||
[app.common.math :as mth]
|
[app.common.math :as mth]
|
||||||
[app.common.pages.changes-builder :as pcb]
|
[app.common.pages.changes-builder :as pcb]
|
||||||
[app.common.schema :as sm]
|
[app.common.schema :as sm]
|
||||||
[app.common.svg :refer [optimize]]
|
|
||||||
[app.common.types.container :as ctn]
|
[app.common.types.container :as ctn]
|
||||||
[app.common.types.shape :as cts]
|
[app.common.types.shape :as cts]
|
||||||
[app.common.types.shape-tree :as ctst]
|
[app.common.types.shape-tree :as ctst]
|
||||||
[app.common.uuid :as uuid]
|
[app.common.uuid :as uuid]
|
||||||
[app.config :as cf]
|
[app.config :as cfg]
|
||||||
[app.main.data.media :as dmm]
|
[app.main.data.media :as dmm]
|
||||||
[app.main.data.messages :as msg]
|
[app.main.data.messages :as msg]
|
||||||
[app.main.data.workspace.changes :as dch]
|
[app.main.data.workspace.changes :as dch]
|
||||||
|
@ -35,34 +34,14 @@
|
||||||
[promesa.core :as p]
|
[promesa.core :as p]
|
||||||
[tubax.core :as tubax]))
|
[tubax.core :as tubax]))
|
||||||
|
|
||||||
(def ^:private svgo-config
|
|
||||||
{:multipass false
|
|
||||||
:plugins
|
|
||||||
[{:name "safePreset"
|
|
||||||
:params {:overrides
|
|
||||||
{:convertColors
|
|
||||||
{:names2hex true
|
|
||||||
:shorthex false
|
|
||||||
:shortname false}
|
|
||||||
:convertTransform
|
|
||||||
{:matrixToTransform false
|
|
||||||
:convertToShorts false
|
|
||||||
:transformPrecision 4
|
|
||||||
:leadingZero false}}}}]})
|
|
||||||
|
|
||||||
(defn svg->clj
|
(defn svg->clj
|
||||||
[[name text]]
|
[[name text]]
|
||||||
(try
|
(try
|
||||||
(let [text (if (contains? cf/flags :frontend-svgo)
|
(->> (rx/of (-> (tubax/xml->clj text)
|
||||||
(optimize text svgo-config)
|
(assoc :name name))))
|
||||||
text)
|
|
||||||
data (-> (tubax/xml->clj text)
|
(catch :default _err
|
||||||
(assoc :name name))]
|
(rx/throw {:type :svg-parser}))))
|
||||||
(rx/of data))
|
|
||||||
(catch :default cause
|
|
||||||
(js/console.error cause)
|
|
||||||
(rx/throw (ex/error :type :svg-parser
|
|
||||||
:hint (ex-message cause))))))
|
|
||||||
|
|
||||||
;; TODO: rename to bitmap-image-uploaded
|
;; TODO: rename to bitmap-image-uploaded
|
||||||
(defn image-uploaded
|
(defn image-uploaded
|
||||||
|
@ -252,7 +231,7 @@
|
||||||
"Load the contents of a media-obj of type svg, and parse it
|
"Load the contents of a media-obj of type svg, and parse it
|
||||||
into a clojure structure."
|
into a clojure structure."
|
||||||
[media-obj]
|
[media-obj]
|
||||||
(let [path (cf/resolve-file-media media-obj)]
|
(let [path (cfg/resolve-file-media media-obj)]
|
||||||
(->> (http/send! {:method :get :uri path :mode :no-cors})
|
(->> (http/send! {:method :get :uri path :mode :no-cors})
|
||||||
(rx/map :body)
|
(rx/map :body)
|
||||||
(rx/map #(vector (:name media-obj) %))
|
(rx/map #(vector (:name media-obj) %))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue