🐛 Fix entering long project name

This commit is contained in:
Alejandro Alonso 2025-06-25 10:24:58 +02:00
parent 4561392791
commit 82583f5079
5 changed files with 15 additions and 10 deletions

View file

@ -86,7 +86,8 @@
(when-not (str/empty? name)
(st/emit! (-> (dd/rename-project (assoc project :name name))
(with-meta {::ev/origin "project"}))))
(swap! local assoc :edition false)))}]
(swap! local assoc :edition false)))
:max-length 250}]
[:div {:class (stl/css :dashboard-title)}
[:h1 {:on-double-click on-edit
:data-testid "project-title"

View file

@ -414,7 +414,8 @@
[:div {:class (stl/css :item-info)}
(if (and (= file-id (:file-id state)) (:edition state))
[:& inline-edition {:content (:name file)
:on-end edit}]
:on-end edit
:max-length 250}]
[:h3 (:name file)])
[:& grid-item-metadata {:modified-at (:modified-at file)}]]

View file

@ -13,7 +13,7 @@
[rumext.v2 :as mf]))
(mf/defc inline-edition
[{:keys [content on-end] :as props}]
[{:keys [content on-end max-length] :as props}]
(let [name (mf/use-state content)
input-ref (mf/use-ref)
@ -61,13 +61,14 @@
(dom/select-text! node))))
[:div {:class (stl/css :edit-wrapper)}
[:input {:class (stl/css :element-title)
:value @name
:ref input-ref
:on-click on-click
:on-change on-input
[:input {:class (stl/css :element-title)
:value @name
:ref input-ref
:on-click on-click
:on-change on-input
:on-key-down on-keyup
:on-blur on-blur}]
:on-blur on-blur
:max-length max-length}]
[:span {:class (stl/css :close)
:on-click on-cancel} i/close]]))

View file

@ -220,7 +220,8 @@
[:div {:class (stl/css :project-name-wrapper)}
(if (:edition @local)
[:& inline-edition {:content (:name project)
:on-end on-edit}]
:on-end on-edit
:max-length 250}]
[:h2 {:on-click on-nav
:style {:max-width (str title-width "%")}
:class (stl/css :project-name)