feat: auto heading

This commit is contained in:
Konstantinos Kaloutas
2022-10-11 14:17:24 +03:00
committed by Tienson Qin
parent 5f4aa91207
commit 6e3a54677d
6 changed files with 47 additions and 24 deletions

View File

@@ -175,14 +175,27 @@
[:div.flex.flex-row.justify-between.flex-1.px-1
(for [i (range 1 7)]
(ui/button
(str "H" i)
""
:icon (str "h-" i)
:class "to-heading-button"
:on-click (fn [_e]
(editor-handler/set-heading! block-id format i))
:intent "link"
:small? true))
(ui/button
"H-"
""
:icon "h-auto"
:icon-props {:extension? true}
:class "to-heading-button"
:title (t :auto-heading)
:on-click (fn [_e]
(editor-handler/set-heading! block-id :org true))
:intent "link"
:small? true)
(ui/button
""
:icon "heading-off"
:icon-props {:extension? true}
:class "to-heading-button"
:title (t :remove-heading)
:on-click (fn [_e]

View File

@@ -338,6 +338,7 @@
:dark "Dark"
:remove-background "Remove background"
:remove-heading "Remove heading"
:auto-heading "Auto heading"
:open "Open"
:open-a-directory "Open a local directory"
:user/delete-account "Delete account"

View File

@@ -59,7 +59,8 @@
"yellow"
"green"
"blue"
"purple"])
"purple"
"pink"])
(rum/defc ls-textarea
< rum/reactive
@@ -949,7 +950,7 @@
(f (merge {:size 18} (r/map-keys->camel-case opts)))])))))))
(defn button
[text & {:keys [background href class intent on-click small? large? title icon]
[text & {:keys [background href class intent on-click small? large? title icon icon-props]
:or {small? false large? false}
:as option}]
(let [klass (when-not intent ".bg-indigo-600.hover:bg-indigo-700.focus:border-indigo-700.active:bg-indigo-700.text-center")
@@ -966,7 +967,7 @@
{:on-click (fn []
(util/open-url href)
(when (fn? on-click) (on-click)))}))
(when icon (frontend.ui/icon icon {:class "mr-1"}))
(when icon (frontend.ui/icon icon (merge icon-props {:class (when-not (empty? text) "mr-1")})))
text]))
(rum/defc type-icon