fix(editor): new block placeholder now accepts tab and enter key

pull/11220/head
Andelf 2024-04-22 11:46:07 +08:00
parent 70a3028c80
commit 8c939a6cbd
2 changed files with 11 additions and 1 deletions

View File

@ -151,7 +151,12 @@
(rum/defc add-button (rum/defc add-button
[args] [args]
[:div.flex-1.flex-col.rounded-sm.add-button-link-wrap [:div.flex-1.flex-col.rounded-sm.add-button-link-wrap
{:on-click (fn [] (editor-handler/api-insert-new-block! "" args))} {:on-click (fn [] (editor-handler/api-insert-new-block! "" args))
:on-key-down (fn [e]
(when (= "Enter" (util/ekey e))
(editor-handler/api-insert-new-block! "" args))
(util/stop e))
:tab-index 0}
[:div.flex.flex-row [:div.flex.flex-row
[:div.block {:style {:height 20 [:div.block {:style {:height 20
:width 20 :width 20

View File

@ -310,6 +310,11 @@ html.is-native-iphone-without-notch {
} }
} }
.add-button-link-wrap:focus .add-button-link {
opacity: .8 !important;
transform: scale(.9);
}
.cp__right-sidebar .add-button-link { .cp__right-sidebar .add-button-link {
margin-left: 21px; margin-left: 21px;
} }