mirror of https://github.com/xwiki-labs/cryptpad
Merge pull request #1598 from cryptpad/generated-avatars-display-on-two-lines
Fix emoji avatar handling and team name overflowing in sidebar teams
This commit is contained in:
commit
564748718f
|
@ -123,8 +123,19 @@ define([
|
|||
if (!seed) { return; }
|
||||
return ANIMALS[seed % ANIMALS.length] || '';
|
||||
};
|
||||
|
||||
//this regex identifies both discord and unicode emojis (with optional skin tone modifiers) and complex zwj emoji sequences
|
||||
const emojiWithZWJRegex = /(?:\p{Extended_Pictographic}(?:\p{Emoji_Modifier}|\uFE0F)?(?:\u200D\p{Extended_Pictographic}(?:\p{Emoji_Modifier}|\uFE0F)?)*|\p{Extended_Pictographic})/gu;
|
||||
var getPrettyInitials = MT.getPrettyInitials = function (name) {
|
||||
let matches = name.match(emojiWithZWJRegex);
|
||||
if (matches && name.startsWith(matches[0])) {
|
||||
return matches[0];
|
||||
}
|
||||
else {
|
||||
//this is for removing all trailing white characters and unnecessary/redundant emojis
|
||||
name = name.replace(emojiWithZWJRegex, '');
|
||||
name = name.replace(/\uFE0F/g, '').replace(/\u200D/g, '').replace(/\u2060/g, '');
|
||||
name = name.trim();
|
||||
}
|
||||
var parts = name.split(/\s+/);
|
||||
var text;
|
||||
if (parts.length > 1) {
|
||||
|
|
|
@ -108,7 +108,7 @@
|
|||
}
|
||||
}
|
||||
.cp-team-cat-header {
|
||||
justify-content: center;
|
||||
justify-content: left;
|
||||
background-color: transparent !important;
|
||||
box-shadow: none !important;
|
||||
.avatar_main(30px);
|
||||
|
@ -118,6 +118,7 @@
|
|||
}
|
||||
media-tag, .cp-avatar-default {
|
||||
margin-right: 3px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
media-tag {
|
||||
order: -1;
|
||||
|
@ -125,7 +126,12 @@
|
|||
cursor: default !important;
|
||||
font-size: 18px;
|
||||
span.cp-sidebarlayout-category-name {
|
||||
max-width: 12rem;
|
||||
padding-left: 5px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
min-width: 0;
|
||||
}
|
||||
}
|
||||
.cp-team-cat-chat {
|
||||
|
|
Loading…
Reference in New Issue