Skip to content

Commit

Permalink
fix(editor): Use segments/graphemes when creating the compact sidebar…
Browse files Browse the repository at this point in the history
… entries
  • Loading branch information
despairblue committed Jun 17, 2024
1 parent 4541a8f commit b2dddd9
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,12 @@ const isItemActive = (item: IMenuItem): boolean => {
};
const getInitials = (label: string): string => {
const words = label.split(' ');
const words = label.split(' ').map((word) => [...new Intl.Segmenter().segment(word)]);
if (words.length === 1) {
return words[0].substring(0, 2);
return words[0][0].segment + words[0][1].segment;
} else {
return words[0].charAt(0) + words[1].charAt(0);
return words[0][0].segment + words[1][0].segment;
}
};
</script>
Expand Down

0 comments on commit b2dddd9

Please sign in to comment.