mirror of
https://github.com/zen-browser/components.git
synced 2025-07-07 21:49:59 +02:00
use intl segmenter
This commit is contained in:
parent
e26ea1f4f0
commit
65a07ce1c7
1 changed files with 6 additions and 1 deletions
|
@ -127,7 +127,9 @@ var ZenWorkspaces = {
|
|||
}
|
||||
},
|
||||
|
||||
_kIcons: JSON.parse(Services.prefs.getStringPref("zen.workspaces.icons")).map((icon) => Array.from(icon)[0]),
|
||||
_kIcons: JSON.parse(Services.prefs.getStringPref("zen.workspaces.icons")).map((icon) => (
|
||||
(typeof Intl.Segmenter !== 'undefined') ? new Intl.Segmenter().segment(icon).containing().segment : Array.from(icon)[0]
|
||||
)),
|
||||
|
||||
_initializeWorkspaceCreationIcons() {
|
||||
let container = document.getElementById('PanelUI-zen-workspaces-create-icons-container');
|
||||
|
@ -248,6 +250,9 @@ var ZenWorkspaces = {
|
|||
if (this.workspaceHasIcon(workspace)) {
|
||||
return workspace.icon;
|
||||
}
|
||||
if (typeof Intl.Segmenter !== 'undefined') {
|
||||
return new Intl.Segmenter().segment(workspace.name).containing().segment.toUpperCase();
|
||||
}
|
||||
return Array.from(workspace.name)[0].toUpperCase();
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue