From 82583f5079cc19ec9e871dd717858d82c15086e3 Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Wed, 25 Jun 2025 10:24:58 +0200 Subject: [PATCH] :bug: Fix entering long project name --- CHANGES.md | 1 + frontend/src/app/main/ui/dashboard/files.cljs | 3 ++- frontend/src/app/main/ui/dashboard/grid.cljs | 3 ++- .../src/app/main/ui/dashboard/inline_edition.cljs | 15 ++++++++------- frontend/src/app/main/ui/dashboard/projects.cljs | 3 ++- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 8a0e021d06..316b7b04e5 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -59,6 +59,7 @@ on-premises instances** that want to keep up to date. - Fix snap nodes shortcut [Taiga #11054](https://tree.taiga.io/project/penpot/issue/11054) - Fix changing a text property in a text layer does not unapply the previously applied token in the same property [Taiga #11337}(https://tree.taiga.io/project/penpot/issue/11337) - Fix shortcut error pressing G+W from the View Mode [Taiga #11061](https://tree.taiga.io/project/penpot/issue/11061) +- Fix entering long project name [Taiga #11417](https://tree.taiga.io/project/penpot/issue/11417) ## 2.7.2 diff --git a/frontend/src/app/main/ui/dashboard/files.cljs b/frontend/src/app/main/ui/dashboard/files.cljs index 08d2230c6b..f1d3d0a314 100644 --- a/frontend/src/app/main/ui/dashboard/files.cljs +++ b/frontend/src/app/main/ui/dashboard/files.cljs @@ -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" diff --git a/frontend/src/app/main/ui/dashboard/grid.cljs b/frontend/src/app/main/ui/dashboard/grid.cljs index f9d66774c9..b59807c62d 100644 --- a/frontend/src/app/main/ui/dashboard/grid.cljs +++ b/frontend/src/app/main/ui/dashboard/grid.cljs @@ -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)}]] diff --git a/frontend/src/app/main/ui/dashboard/inline_edition.cljs b/frontend/src/app/main/ui/dashboard/inline_edition.cljs index 0ceda89a6d..7dc80343ae 100644 --- a/frontend/src/app/main/ui/dashboard/inline_edition.cljs +++ b/frontend/src/app/main/ui/dashboard/inline_edition.cljs @@ -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]])) diff --git a/frontend/src/app/main/ui/dashboard/projects.cljs b/frontend/src/app/main/ui/dashboard/projects.cljs index cf013de2ab..5f2c830fa3 100644 --- a/frontend/src/app/main/ui/dashboard/projects.cljs +++ b/frontend/src/app/main/ui/dashboard/projects.cljs @@ -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)