0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-15 17:21:17 -05:00

Revert " Add support for svg optimizations on workspace svg import"

This reverts commit b92fcca17c.
This commit is contained in:
Andrey Antukh 2023-09-15 12:19:26 +02:00
parent 9d090ad3d9
commit 11df5ec15e

View file

@ -12,12 +12,11 @@
[app.common.math :as mth]
[app.common.pages.changes-builder :as pcb]
[app.common.schema :as sm]
[app.common.svg :refer [optimize]]
[app.common.types.container :as ctn]
[app.common.types.shape :as cts]
[app.common.types.shape-tree :as ctst]
[app.common.uuid :as uuid]
[app.config :as cf]
[app.config :as cfg]
[app.main.data.media :as dmm]
[app.main.data.messages :as msg]
[app.main.data.workspace.changes :as dch]
@ -35,34 +34,14 @@
[promesa.core :as p]
[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
[[name text]]
(try
(let [text (if (contains? cf/flags :frontend-svgo)
(optimize text svgo-config)
text)
data (-> (tubax/xml->clj text)
(assoc :name name))]
(rx/of data))
(catch :default cause
(js/console.error cause)
(rx/throw (ex/error :type :svg-parser
:hint (ex-message cause))))))
(->> (rx/of (-> (tubax/xml->clj text)
(assoc :name name))))
(catch :default _err
(rx/throw {:type :svg-parser}))))
;; TODO: rename to bitmap-image-uploaded
(defn image-uploaded
@ -252,7 +231,7 @@
"Load the contents of a media-obj of type svg, and parse it
into a clojure structure."
[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})
(rx/map :body)
(rx/map #(vector (:name media-obj) %))