From 80bf4ea2a3886b8ea20679500b5a9f0c3a1c9066 Mon Sep 17 00:00:00 2001 From: Alex Hall Date: Fri, 17 Sep 2021 00:49:28 +0200 Subject: [PATCH] =?UTF-8?q?(core)=20Get=20first=20unicode=20character=20(e?= =?UTF-8?q?.g.=20=F0=9F=93=9D=20)=20for=20page=20label,=20not=201st=20byte?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- app/client/ui2018/pages.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/client/ui2018/pages.ts b/app/client/ui2018/pages.ts index 27f59b05..d0b8c4a0 100644 --- a/app/client/ui2018/pages.ts +++ b/app/client/ui2018/pages.ts @@ -52,7 +52,7 @@ export function buildPageDom(name: Observable, 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, 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'),