Revize 80244bde
Přidáno uživatelem Lukáš Vlček před asi 2 roky(ů)
webapp/utils/strings.ts | ||
---|---|---|
7 | 7 |
|
8 | 8 |
export function getNameTruncated(user: UserInfo, maxLength: number = 15) { |
9 | 9 |
const name = getName(user); |
10 |
if (name.length > maxLength) { |
|
11 |
return name.substring(0, maxLength - 3) + '...'; |
|
10 |
return getTextMaxLength(name, maxLength); |
|
11 |
} |
|
12 |
|
|
13 |
export function getTextMaxLength(text: string, maxLength: number) { |
|
14 |
if (text.length > maxLength) { |
|
15 |
return text.substring(0, maxLength - 3) + '...'; |
|
12 | 16 |
} else { |
13 |
return name;
|
|
17 |
return text;
|
|
14 | 18 |
} |
15 | 19 |
} |
16 | 20 |
|
Také k dispozici: Unified diff
AnnotationItem selected text showing, other minor improvements