From cbfec5172d9df37992ca5087ef0c59fcaba344f0 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Wed, 14 Sep 2022 23:25:44 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E8=87=AA=E5=AE=9A=E4=B9=89=E8=A1=A8?= =?UTF-8?q?=E6=83=85=E6=90=9C=E7=B4=A2=E6=8A=A5=E9=94=99=20Fix=20https://g?= =?UTF-8?q?ithub.com/siyuan-note/siyuan/issues/5883?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/emoji/index.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/app/src/emoji/index.ts b/app/src/emoji/index.ts index d6ddcb229..5c5702603 100644 --- a/app/src/emoji/index.ts +++ b/app/src/emoji/index.ts @@ -25,13 +25,18 @@ export const unicode2Emoji = (unicode: string, assic = false) => { if (unicode.indexOf(".") > -1) { emoji = ``; } else if (isMobile() || window.siyuan.config.appearance.nativeEmoji || assic) { - unicode.split("-").forEach(item => { - if (item.length < 5) { - emoji += String.fromCodePoint(parseInt("0" + item, 16)); - } else { - emoji += String.fromCodePoint(parseInt(item, 16)); - } - }); + try { + unicode.split("-").forEach(item => { + if (item.length < 5) { + emoji += String.fromCodePoint(parseInt("0" + item, 16)); + } else { + emoji += String.fromCodePoint(parseInt(item, 16)); + } + }); + } catch (e) { + // 自定义表情搜索报错 https://github.com/siyuan-note/siyuan/issues/5883 + // 这里忽略错误不做处理 + } } else { emoji = ``; }