0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-22 22:49:01 -05:00

🎉 Add feature to select full values on click at the design sidebar

This commit is contained in:
Akshay Gupta 2023-04-30 22:15:45 +05:30 committed by Alejandro Alonso
parent ceeed73dea
commit 1c0e1237c2
3 changed files with 13 additions and 1 deletions

View file

@ -18,7 +18,8 @@
- Update Typography palette order (by @akshay-gupta7) [Github #3156](https://github.com/penpot/penpot/pull/3156) - Update Typography palette order (by @akshay-gupta7) [Github #3156](https://github.com/penpot/penpot/pull/3156)
- Palettes (color, typographies) empty state (by @akshay-gupta7) [Github #3160](https://github.com/penpot/penpot/pull/3160) - Palettes (color, typographies) empty state (by @akshay-gupta7) [Github #3160](https://github.com/penpot/penpot/pull/3160)
- Duplicate objects via drag + alt (by @akshay-gupta7) [Github #3147](https://github.com/penpot/penpot/pull/3147) - Duplicate objects via drag + alt (by @akshay-gupta7) [Github #3147](https://github.com/penpot/penpot/pull/3147)
-Set line-height to auto as 1.2 (by @akshay-gupta7) [Github #3185](https://github.com/penpot/penpot/pull/3185) - Set line-height to auto as 1.2 (by @akshay-gupta7) [Github #3185](https://github.com/penpot/penpot/pull/3185)
- Click to select full values at the design sidebar (by @akshay-gupta7) [Github #3179](https://github.com/penpot/penpot/pull/3179)
## 1.18.3 (Unreleased) ## 1.18.3 (Unreleased)

View file

@ -11,11 +11,15 @@
[app.main.store :as st] [app.main.store :as st]
[app.main.ui.icons :as i] [app.main.ui.icons :as i]
[app.main.ui.workspace.sidebar.options.rows.input-row :refer [input-row]] [app.main.ui.workspace.sidebar.options.rows.input-row :refer [input-row]]
[app.util.dom :as dom]
[app.util.i18n :as i18n :refer [tr]] [app.util.i18n :as i18n :refer [tr]]
[rumext.v2 :as mf])) [rumext.v2 :as mf]))
(def blur-attrs [:blur]) (def blur-attrs [:blur])
(defn select-all [event]
(dom/select-text! (dom/get-target event)))
(defn create-blur [] (defn create-blur []
(let [id (uuid/next)] (let [id (uuid/next)]
{:id id {:id id
@ -82,6 +86,7 @@
(cond (cond
has-value? has-value?
[:div.element-set-content [:div.element-set-content
{:on-focus select-all}
[:& input-row {:label "Value" [:& input-row {:label "Value"
:class "pixels" :class "pixels"
:min "0" :min "0"

View file

@ -37,6 +37,9 @@
"" ""
(ust/format-precision value 2))) (ust/format-precision value 2)))
(defn select-all [event]
(dom/select-text! (dom/get-target event)))
(defn- get-next-font (defn- get-next-font
[{:keys [id] :as current} fonts] [{:keys [id] :as current} fonts]
(if (seq fonts) (if (seq fonts)
@ -340,6 +343,7 @@
[:div.row-flex [:div.row-flex
{:on-focus select-all}
(let [size-options [8 9 10 11 12 14 16 18 24 36 48 72] (let [size-options [8 9 10 11 12 14 16 18 24 36 48 72]
size-options (if (= font-size :multiple) (into [""] size-options) size-options)] size-options (if (= font-size :multiple) (into [""] size-options) size-options)]
[:& editable-select [:& editable-select
@ -394,6 +398,7 @@
:placeholder (tr "settings.multiple") :placeholder (tr "settings.multiple")
:nillable line-height-nillable :nillable line-height-nillable
:on-change #(handle-change % :line-height) :on-change #(handle-change % :line-height)
:on-focus select-all
:on-blur on-blur}]] :on-blur on-blur}]]
[:div.input-icon [:div.input-icon
@ -407,6 +412,7 @@
:value (attr->string letter-spacing) :value (attr->string letter-spacing)
:placeholder (tr "settings.multiple") :placeholder (tr "settings.multiple")
:on-change #(handle-change % :letter-spacing) :on-change #(handle-change % :letter-spacing)
:on-focus select-all
:on-blur on-blur}]]])) :on-blur on-blur}]]]))
(mf/defc text-transform-options (mf/defc text-transform-options