Browse Source

feat: select title texts on focus

Peng Xiao 3 years ago
parent
commit
4e928d880e
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/main/frontend/components/page.cljs

+ 2 - 1
src/main/frontend/components/page.cljs

@@ -266,7 +266,8 @@
                             ;; Esc
                             (when (= 27 (.-keyCode e))
                               (reset! *title-value old-name)
-                              (reset! *edit? false)))}]]
+                              (reset! *edit? false)))
+           :on-focus (fn [] (js/setTimeout #(.select input-ref.current)))}]]
         [:a.page-title {:on-mouse-down (fn [e]
                                          (when (util/right-click? e)
                                            (state/set-state! :page-title/context {:page page-name})))