diff --git a/common/src/app/common/files/migrations.cljc b/common/src/app/common/files/migrations.cljc index eeb11e9067..5721910890 100644 --- a/common/src/app/common/files/migrations.cljc +++ b/common/src/app/common/files/migrations.cljc @@ -1805,6 +1805,21 @@ {})] (cfcp/sync-component-id-with-ref-shape data libraries))) +(defmethod migrate-data "0021-fix-shape-svg-attrs" + [data _] + (some-> cfeat/*new* (swap! conj "fdata/shape-data-type")) + (letfn [(update-object [object] + (-> object + (d/update-when :svg-attrs csvg/attrs->props) + (d/update-when :svg-viewbox grc/make-rect))) + + (update-container [container] + (d/update-when container :objects d/update-vals update-object))] + + (-> data + (update :pages-index d/update-vals update-container) + (d/update-when :components d/update-vals update-container)))) + (def available-migrations (into (d/ordered-set) ["legacy-2" @@ -1882,4 +1897,5 @@ "0017-fix-layout-flex-dir" "0018-remove-unneeded-objects-from-components" "0019-fix-missing-swap-slots" - "0020-sync-component-id-with-near-main"])) + "0020-sync-component-id-with-near-main" + "0021-fix-shape-svg-attrs"])) diff --git a/frontend/src/app/main/data/workspace/svg_upload.cljs b/frontend/src/app/main/data/workspace/svg_upload.cljs index a573cd594b..265c31b0b2 100644 --- a/frontend/src/app/main/data/workspace/svg_upload.cljs +++ b/frontend/src/app/main/data/workspace/svg_upload.cljs @@ -47,10 +47,12 @@ (-> item (assoc :name (extract-name href)) (assoc :url href)))))) + (rx/filter (fn [item] + (or (contains? item :content) + (let [url (:url item)] + (or (str/starts-with? url "http://") + (str/starts-with? url "https://")))))) (rx/mapcat (fn [item] - ;; TODO: :create-file-media-object-from-url is - ;; deprecated and this should be resolved in - ;; frontend (->> (rp/cmd! (if (contains? item :content) :upload-file-media-object :create-file-media-object-from-url) diff --git a/frontend/src/app/render_wasm/api.cljs b/frontend/src/app/render_wasm/api.cljs index 6924456411..2d3b106451 100644 --- a/frontend/src/app/render_wasm/api.cljs +++ b/frontend/src/app/render_wasm/api.cljs @@ -762,16 +762,10 @@ (defn set-shape-svg-attrs [attrs] (let [style (:style attrs) - ;; Filter to only supported attributes - allowed-keys #{:fill :fillRule :fill-rule :strokeLinecap :stroke-linecap :strokeLinejoin :stroke-linejoin} - attrs (-> attrs - (dissoc :style) - (merge style) - (select-keys allowed-keys)) - fill-rule (-> (or (:fill-rule attrs) (:fillRule attrs)) sr/translate-fill-rule) - stroke-linecap (-> (or (:stroke-linecap attrs) (:strokeLinecap attrs)) sr/translate-stroke-linecap) - stroke-linejoin (-> (or (:stroke-linejoin attrs) (:strokeLinejoin attrs)) sr/translate-stroke-linejoin) - fill-none (= "none" (-> attrs :fill))] + fill-rule (-> (or (:fillRule style) (:fillRule attrs)) sr/translate-fill-rule) + stroke-linecap (-> (or (:strokeLinecap style) (:strokeLinecap attrs)) sr/translate-stroke-linecap) + stroke-linejoin (-> (or (:strokeLinejoin style) (:strokeLinejoin attrs)) sr/translate-stroke-linejoin) + fill-none (= "none" (or (:fill style) (:fill attrs)))] (h/call wasm/internal-module "_set_shape_svg_attrs" fill-rule stroke-linecap stroke-linejoin fill-none))) (defn set-shape-path-content