0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-04-12 06:51:23 -05:00

🐛 Fix long file names (#6216)

* 🔧 Add truncate str macro

* 🐛 Use truncate instead of prune to prevent title override

* 💄 Use text-overflow ellipsis on file names

* 📎 Add #10662 to 2.7 bugfixes
This commit is contained in:
Elena Torró 2025-04-03 16:06:02 +02:00 committed by GitHub
parent cd731c3ad2
commit 480c224250
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 16 additions and 3 deletions

View file

@ -16,6 +16,7 @@
- Fix SVG `stroke-linecap` property when importing SVGs [Taiga #9489](https://tree.taiga.io/project/penpot/issue/9489)
- Fix position problems cutting-pasting a component [Taiga #10677](https://tree.taiga.io/project/penpot/issue/10677)
- Fix design tab has a horizontal scroll [Taiga #10660](https://tree.taiga.io/project/penpot/issue/10660)
- Fix long file names being clipped when longer than allowed length [Taiga #10662](https://tree.taiga.io/project/penpot/issue/10662)
## 2.6.0 (Unreleased)

View file

@ -6,7 +6,7 @@
(ns app.common.data.macros
"Data retrieval & manipulation specific macros."
(:refer-clojure :exclude [get-in select-keys str with-open min max])
(:refer-clojure :exclude [get-in select-keys str with-open max])
#?(:cljs (:require-macros [app.common.data.macros]))
(:require
#?(:clj [clojure.core :as c]
@ -144,3 +144,8 @@
(str "expr assert: " (pr-str expr)))]
(when *assert*
`(runtime-assert ~hint (fn [] ~expr))))))
(defn truncate
"Truncates a string to a certain length"
[s max-length]
(subs s 0 (min max-length (count s))))

View file

@ -698,7 +698,7 @@
(defn rename-file
[id name]
{:pre [(uuid? id) (string? name)]}
(let [name (str/prune name 200)]
(let [name (dm/truncate name 200)]
(ptk/reify ::rename-file
IDeref
(-deref [_]

View file

@ -304,6 +304,7 @@
}
.file-name-label {
@include bodyLargeTypography;
@include textEllipsis;
}
}
&.loading {

View file

@ -199,6 +199,7 @@
.file-entry {
.file-name {
@include flexRow;
.file-icon {
@include flexCenter;
height: $s-16;
@ -211,6 +212,7 @@
}
.file-name-label {
@include bodyLargeTypography;
@include textEllipsis;
}
}
&.loading {

View file

@ -132,7 +132,7 @@
:saved i/status-tick
:error i/status-wrong
nil)]
file-name])]
[:div {:class (stl/css :file-name-label)} file-name]])]
(when ^boolean shared?
[:span {:class (stl/css :shared-badge)} i/library])
[:div {:class (stl/css :menu-section)}

View file

@ -54,6 +54,10 @@
flex-direction: row;
}
.file-name-label {
@include textEllipsis;
}
.file-name-input {
@include flexCenter;
width: 100%;