Merge remote-tracking branch 'origin/staging' into develop

This commit is contained in:
Alejandro Alonso 2022-12-30 07:46:38 +01:00
commit 9c44cd343f
4 changed files with 40 additions and 37 deletions

View File

@ -33,6 +33,9 @@
- Fix problem when moving texts with keyboard [#2690](https://github.com/penpot/penpot/issues/2690) - Fix problem when moving texts with keyboard [#2690](https://github.com/penpot/penpot/issues/2690)
- Fix problem when drawing boxes won't detect mouse-up [Taiga #4618](https://tree.taiga.io/project/penpot/issue/4618) - Fix problem when drawing boxes won't detect mouse-up [Taiga #4618](https://tree.taiga.io/project/penpot/issue/4618)
- Fix missing loading icon on shared libraries [Taiga #4148](https://tree.taiga.io/project/penpot/issue/4148) - Fix missing loading icon on shared libraries [Taiga #4148](https://tree.taiga.io/project/penpot/issue/4148)
- Fix selection stroke missing in properties of multiple texts [Taiga #4048](https://tree.taiga.io/project/penpot/issue/4048)
- Fix missing create component menu for frames [Github #2670](https://github.com/penpot/penpot/issues/2670)
- Fix "currentColor" is not converted when importing SVG [Github 2276](https://github.com/penpot/penpot/issues/2276)
### :arrow_up: Deps updates ### :arrow_up: Deps updates

View File

@ -373,6 +373,7 @@
:fill-color-ref-file :fill-color-ref-file
:fill-color-gradient :fill-color-gradient
:strokes
:stroke-style :stroke-style
:stroke-alignment :stroke-alignment
:stroke-width :stroke-width

View File

@ -6,6 +6,7 @@
(ns app.main.data.workspace.svg-upload (ns app.main.data.workspace.svg-upload
(:require (:require
[app.common.colors :as clr]
[app.common.data :as d] [app.common.data :as d]
[app.common.geom.matrix :as gmt] [app.common.geom.matrix :as gmt]
[app.common.geom.point :as gpt] [app.common.geom.point :as gpt]
@ -73,34 +74,34 @@
:else (str tag)))) :else (str tag))))
(defn setup-fill [shape] (defn setup-fill [shape]
(cond-> shape (let [color-attr (str/trim (get-in shape [:svg-attrs :fill]))
color-attr (if (= color-attr "currentColor") clr/black color-attr)
color-style (str/trim (get-in shape [:svg-attrs :style :fill]))
color-style (if (= color-style "currentColor") clr/black color-style)]
(cond-> shape
;; Color present as attribute ;; Color present as attribute
(uc/color? (str/trim (get-in shape [:svg-attrs :fill]))) (uc/color? color-attr)
(-> (update :svg-attrs dissoc :fill) (-> (update :svg-attrs dissoc :fill)
(update-in [:svg-attrs :style] dissoc :fill) (update-in [:svg-attrs :style] dissoc :fill)
(assoc-in [:fills 0 :fill-color] (-> (get-in shape [:svg-attrs :fill]) (assoc-in [:fills 0 :fill-color] (uc/parse-color color-attr)))
(str/trim)
(uc/parse-color))))
;; Color present as style ;; Color present as style
(uc/color? (str/trim (get-in shape [:svg-attrs :style :fill]))) (uc/color? color-style)
(-> (update-in [:svg-attrs :style] dissoc :fill) (-> (update-in [:svg-attrs :style] dissoc :fill)
(update :svg-attrs dissoc :fill) (update :svg-attrs dissoc :fill)
(assoc-in [:fills 0 :fill-color] (-> (get-in shape [:svg-attrs :style :fill]) (assoc-in [:fills 0 :fill-color] (uc/parse-color color-style)))
(str/trim)
(uc/parse-color))))
(get-in shape [:svg-attrs :fill-opacity]) (get-in shape [:svg-attrs :fill-opacity])
(-> (update :svg-attrs dissoc :fill-opacity) (-> (update :svg-attrs dissoc :fill-opacity)
(update-in [:svg-attrs :style] dissoc :fill-opacity) (update-in [:svg-attrs :style] dissoc :fill-opacity)
(assoc-in [:fills 0 :fill-opacity] (-> (get-in shape [:svg-attrs :fill-opacity]) (assoc-in [:fills 0 :fill-opacity] (-> (get-in shape [:svg-attrs :fill-opacity])
(d/parse-double)))) (d/parse-double))))
(get-in shape [:svg-attrs :style :fill-opacity]) (get-in shape [:svg-attrs :style :fill-opacity])
(-> (update-in [:svg-attrs :style] dissoc :fill-opacity) (-> (update-in [:svg-attrs :style] dissoc :fill-opacity)
(update :svg-attrs dissoc :fill-opacity) (update :svg-attrs dissoc :fill-opacity)
(assoc-in [:fills 0 :fill-opacity] (-> (get-in shape [:svg-attrs :style :fill-opacity]) (assoc-in [:fills 0 :fill-opacity] (-> (get-in shape [:svg-attrs :style :fill-opacity])
(d/parse-double)))))) (d/parse-double)))))))
(defn setup-stroke [shape] (defn setup-stroke [shape]
(let [stroke-linecap (-> (or (get-in shape [:svg-attrs :stroke-linecap]) (let [stroke-linecap (-> (or (get-in shape [:svg-attrs :stroke-linecap])

View File

@ -398,7 +398,6 @@
[{:keys [shapes]}] [{:keys [shapes]}]
(let [single? (= (count shapes) 1) (let [single? (= (count shapes) 1)
has-frame? (->> shapes (d/seek cph/frame-shape?))
has-component? (some true? (map #(contains? % :component-id) shapes)) has-component? (some true? (map #(contains? % :component-id) shapes))
is-component? (and single? (-> shapes first :component-id some?)) is-component? (and single? (-> shapes first :component-id some?))
@ -454,19 +453,18 @@
:accept-style :primary :accept-style :primary
:on-accept do-update-component-in-bulk}))] :on-accept do-update-component-in-bulk}))]
[:* [:*
(when (not has-frame?) [:*
[:* [:& menu-separator]
[:& menu-separator] [:& menu-entry {:title (tr "workspace.shape.menu.create-component")
[:& menu-entry {:title (tr "workspace.shape.menu.create-component") :shortcut (sc/get-tooltip :create-component)
:shortcut (sc/get-tooltip :create-component) :on-click do-add-component}]
:on-click do-add-component}] (when (and has-component? (not single?))
(when (and has-component? (not single?)) [:*
[:* [:& menu-entry {:title (tr "workspace.shape.menu.detach-instances-in-bulk")
[:& menu-entry {:title (tr "workspace.shape.menu.detach-instances-in-bulk") :shortcut (sc/get-tooltip :detach-component)
:shortcut (sc/get-tooltip :detach-component) :on-click do-detach-component-in-bulk}]
:on-click do-detach-component-in-bulk}] [:& menu-entry {:title (tr "workspace.shape.menu.update-components-in-bulk")
[:& menu-entry {:title (tr "workspace.shape.menu.update-components-in-bulk") :on-click do-update-in-bulk}]])]
:on-click do-update-in-bulk}]])])
(when is-component? (when is-component?
;; WARNING: this menu is the same as the context menu at the sidebar. ;; WARNING: this menu is the same as the context menu at the sidebar.