(core) Get first unicode character (e.g. 📝 ) for page label, not 1st byte

Summary:
📝

https://community.getgrist.com/t/feature-request-custom-icon-favicon-for-each-document/210/2

```
>>> json.dumps("📝")
'"\\ud83d\\udcdd"'
>>> json.dumps("")
'"\\u2728"'
```

```
> "📝 abc"[0]
'\uD83D'
> "📝 abc"[1]
'\uDCDD'
> Array.from("📝 abc")
['📝', ' ', 'a', 'b', 'c']
> Array.from("📝 abc")[0]
'📝'
```

Test Plan: no

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D3026
This commit is contained in:
Alex Hall 2021-09-17 00:49:28 +02:00
parent 7907467dbc
commit 80bf4ea2a3

View File

@ -52,7 +52,7 @@ export function buildPageDom(name: Observable<string>, actions: PageActions, ...
domComputed(isRenaming, (isrenaming) => (
isrenaming ?
cssPageItem(
cssPageInitial(dom.text((use) => use(name)[0])),
cssPageInitial(dom.text((use) => Array.from(use(name))[0])),
cssEditorInput(
{
initialValue: name.get() || '',
@ -68,7 +68,7 @@ export function buildPageDom(name: Observable<string>, actions: PageActions, ...
// firefox.
) :
cssPageItem(
cssPageInitial(dom.text((use) => use(name)[0])),
cssPageInitial(dom.text((use) => Array.from(use(name))[0])),
cssPageName(dom.text(name), testId('label')),
cssPageMenuTrigger(
cssPageIcon('Dots'),