🐛 Fix shortcuts for alignment

This commit is contained in:
alonso.torres 2023-03-22 14:25:24 +01:00
parent 09d0a9e3f8
commit 6d93501dc7
3 changed files with 24 additions and 24 deletions

View file

@ -40,6 +40,7 @@
- Fix deleted files appear in search results [Taiga #5002](https://tree.taiga.io/project/penpot/issue/5002) - Fix deleted files appear in search results [Taiga #5002](https://tree.taiga.io/project/penpot/issue/5002)
- Fix problem with selected colors and texts [Taiga #5051](https://tree.taiga.io/project/penpot/issue/5051) - Fix problem with selected colors and texts [Taiga #5051](https://tree.taiga.io/project/penpot/issue/5051)
- Fix problem when assigning color from palette or assets [Taiga #5050](https://tree.taiga.io/project/penpot/issue/5050) - Fix problem when assigning color from palette or assets [Taiga #5050](https://tree.taiga.io/project/penpot/issue/5050)
- Fix shortcuts for alignment [Taiga #5030](https://tree.taiga.io/project/penpot/issue/5030)
### :heart: Community contributions by (Thank you!) ### :heart: Community contributions by (Thank you!)
- To @ondrejkonec: for contributing to the code with: - To @ondrejkonec: for contributing to the code with:

View file

@ -202,19 +202,19 @@
(st/emit! (dwu/commit-undo-transaction undo-id))))) (st/emit! (dwu/commit-undo-transaction undo-id)))))
(def shortcuts (def shortcuts
{:align-left {:tooltip (ds/meta (ds/alt "l")) {:text-align-left {:tooltip (ds/meta (ds/alt "l"))
:command (ds/c-mod "alt+l") :command (ds/c-mod "alt+l")
:subsections [:text-editor] :subsections [:text-editor]
:fn #(update-attrs-when-no-readonly {:text-align "left"})} :fn #(update-attrs-when-no-readonly {:text-align "left"})}
:align-right {:tooltip (ds/meta (ds/alt "r")) :text-align-right {:tooltip (ds/meta (ds/alt "r"))
:command (ds/c-mod "alt+r") :command (ds/c-mod "alt+r")
:subsections [:text-editor] :subsections [:text-editor]
:fn #(update-attrs-when-no-readonly {:text-align "right"})} :fn #(update-attrs-when-no-readonly {:text-align "right"})}
:align-center {:tooltip (ds/meta (ds/alt "t")) :text-align-center {:tooltip (ds/meta (ds/alt "t"))
:command (ds/c-mod "alt+t") :command (ds/c-mod "alt+t")
:subsections [:text-editor] :subsections [:text-editor]
:fn #(update-attrs-when-no-readonly {:text-align "center"})} :fn #(update-attrs-when-no-readonly {:text-align "center"})}
:align-justify {:tooltip (ds/meta (ds/alt "j")) :text-align-justify {:tooltip (ds/meta (ds/alt "j"))
:command (ds/c-mod "alt+j") :command (ds/c-mod "alt+j")
:subsections [:text-editor] :subsections [:text-editor]
:fn #(update-attrs-when-no-readonly {:text-align "justify"})} :fn #(update-attrs-when-no-readonly {:text-align "justify"})}

View file

@ -11,6 +11,7 @@
[app.common.uuid :as uuid] [app.common.uuid :as uuid]
[app.main.data.workspace.changes :as dch] [app.main.data.workspace.changes :as dch]
[app.main.data.workspace.libraries :as dwl] [app.main.data.workspace.libraries :as dwl]
[app.main.data.workspace.shortcuts :as sc]
[app.main.data.workspace.texts :as dwt] [app.main.data.workspace.texts :as dwt]
[app.main.data.workspace.undo :as dwu] [app.main.data.workspace.undo :as dwu]
[app.main.fonts :as fonts] [app.main.fonts :as fonts]
@ -25,8 +26,6 @@
[cuerdas.core :as str] [cuerdas.core :as str]
[rumext.v2 :as mf])) [rumext.v2 :as mf]))
(mf/defc text-align-options (mf/defc text-align-options
[{:keys [values on-change on-blur] :as props}] [{:keys [values on-change on-blur] :as props}]
(let [{:keys [text-align]} values (let [{:keys [text-align]} values
@ -38,22 +37,22 @@
;; --- Align ;; --- Align
[:div.align-icons [:div.align-icons
[:span.tooltip.tooltip-bottom [:span.tooltip.tooltip-bottom
{:alt (tr "workspace.options.text-options.align-left") {:alt (tr "workspace.options.text-options.align-left" (sc/get-tooltip :text-align-left))
:class (dom/classnames :current (= "left" text-align)) :class (dom/classnames :current (= "left" text-align))
:on-click #(handle-change % "left")} :on-click #(handle-change % "left")}
i/text-align-left] i/text-align-left]
[:span.tooltip.tooltip-bottom [:span.tooltip.tooltip-bottom
{:alt (tr "workspace.options.text-options.align-center") {:alt (tr "workspace.options.text-options.align-center" (sc/get-tooltip :text-align-center))
:class (dom/classnames :current (= "center" text-align)) :class (dom/classnames :current (= "center" text-align))
:on-click #(handle-change % "center")} :on-click #(handle-change % "center")}
i/text-align-center] i/text-align-center]
[:span.tooltip.tooltip-bottom [:span.tooltip.tooltip-bottom
{:alt (tr "workspace.options.text-options.align-right") {:alt (tr "workspace.options.text-options.align-right" (sc/get-tooltip :text-align-right))
:class (dom/classnames :current (= "right" text-align)) :class (dom/classnames :current (= "right" text-align))
:on-click #(handle-change % "right")} :on-click #(handle-change % "right")}
i/text-align-right] i/text-align-right]
[:span.tooltip.tooltip-bottom [:span.tooltip.tooltip-bottom
{:alt (tr "workspace.options.text-options.align-justify") {:alt (tr "workspace.options.text-options.align-justify" (sc/get-tooltip :text-align-justify))
:class (dom/classnames :current (= "justify" text-align)) :class (dom/classnames :current (= "justify" text-align))
:on-click #(handle-change % "justify")} :on-click #(handle-change % "justify")}
i/text-align-justify]])) i/text-align-justify]]))
@ -149,13 +148,13 @@
i/minus] i/minus]
[:span.tooltip.tooltip-bottom [:span.tooltip.tooltip-bottom
{:alt (tr "workspace.options.text-options.underline") {:alt (tr "workspace.options.text-options.underline" (sc/get-tooltip :underline))
:class (dom/classnames :current (= "underline" text-decoration)) :class (dom/classnames :current (= "underline" text-decoration))
:on-click #(handle-change % "underline")} :on-click #(handle-change % "underline")}
i/underline] i/underline]
[:span.tooltip.tooltip-bottom [:span.tooltip.tooltip-bottom
{:alt (tr "workspace.options.text-options.strikethrough") {:alt (tr "workspace.options.text-options.strikethrough" (sc/get-tooltip :line-through))
:class (dom/classnames :current (= "line-through" text-decoration)) :class (dom/classnames :current (= "line-through" text-decoration))
:on-click #(handle-change % "line-through")} :on-click #(handle-change % "line-through")}
i/strikethrough]])) i/strikethrough]]))