From e0b7001a09bdc46653d0d9fe7c6e734fbe4bc5a3 Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Tue, 4 Jan 2022 09:55:19 +0100 Subject: [PATCH] :bug: Fix default color fill for textx --- CHANGES.md | 1 + common/src/app/common/text.cljc | 6 ++---- .../app/main/ui/workspace/sidebar/options/menus/fill.cljs | 7 +++---- .../app/main/ui/workspace/sidebar/options/shapes/text.cljs | 6 +++++- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index adfae3bf8..e42ea6007 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,6 +5,7 @@ ### :boom: Breaking changes ### :sparkles: New features +- Setting fill automatically for new texts [Taiga #2441](https://tree.taiga.io/project/penpot/us/2441). - Add shortcut to move action [Github #1213](https://github.com/penpot/penpot/issues/1213). - Add alt as mod key to add stroke color from library menu [Taiga #2207](https://tree.taiga.io/project/penpot/us/2207). - Add detach in bulk option to context menu [Taiga #2210](https://tree.taiga.io/project/penpot/us/2210). diff --git a/common/src/app/common/text.cljc b/common/src/app/common/text.cljc index f4c450f1a..a48f525d4 100644 --- a/common/src/app/common/text.cljc +++ b/common/src/app/common/text.cljc @@ -6,6 +6,7 @@ (ns app.common.text (:require + [app.common.colors :as clr] [app.common.data :as d] [app.common.transit :as t] [clojure.walk :as walk] @@ -25,7 +26,7 @@ :text-transform "none" :text-align "left" :text-decoration "none" - :fill-color nil + :fill-color clr/black :fill-opacity 1}) (def typography-fields @@ -247,6 +248,3 @@ {:blocks (reduce #(conj %1 (build-block %2)) [] (node-seq #(= (:type %) "paragraph") root)) :entityMap {}})) - - - diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/fill.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/fill.cljs index e1d0ee4b4..7fcabb0b0 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/fill.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/fill.cljs @@ -24,7 +24,7 @@ (mf/defc fill-menu {::mf/wrap [#(mf/memo' % (mf/check-props ["ids" "values"]))]} - [{:keys [ids type values] :as props}] + [{:keys [ids type values disable-remove?] :as props}] (let [show? (or (not (nil? (:fill-color values))) (not (nil? (:fill-color-gradient values)))) @@ -75,7 +75,8 @@ [:div.element-set [:div.element-set-title [:span label] - [:div.add-page {:on-click on-delete} i/minus]] + (when (not disable-remove?) + [:div.add-page {:on-click on-delete} i/minus])] [:div.element-set-content [:& color-row {:color color @@ -87,5 +88,3 @@ [:div.element-set-title [:span label] [:div.add-page {:on-click on-add} i/close]]]))) - - diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/shapes/text.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/shapes/text.cljs index a8eccfa4d..804703cd6 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/shapes/text.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/shapes/text.cljs @@ -6,6 +6,7 @@ (ns app.main.ui.workspace.sidebar.options.shapes.text (:require + [app.common.colors :as clr] [app.common.data :as d] [app.main.data.workspace.texts :as dwt] [app.main.refs :as refs] @@ -36,6 +37,8 @@ fill-values (d/update-in-when fill-values [:fill-color-gradient :type] keyword) fill-values (cond-> fill-values + (not (contains? fill-values :fill-color)) (assoc :fill-color clr/black) + (not (contains? fill-values :fill-opacity)) (assoc :fill-opacity 1) ;; Keep for backwards compatibility (:fill fill-values) (assoc :fill-color (:fill fill-values)) (:opacity fill-values) (assoc :fill-opacity (:fill fill-values))) @@ -73,7 +76,8 @@ [:& fill-menu {:ids ids :type type - :values fill-values}] + :values fill-values + :disable-remove? true}] [:& shadow-menu {:ids ids