mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 16:40:13 +01:00
🐛 自定义表情搜索报错 Fix https://github.com/siyuan-note/siyuan/issues/5883
This commit is contained in:
parent
00533d95ac
commit
cbfec5172d
1 changed files with 12 additions and 7 deletions
|
|
@ -25,13 +25,18 @@ export const unicode2Emoji = (unicode: string, assic = false) => {
|
|||
if (unicode.indexOf(".") > -1) {
|
||||
emoji = `<img src="/emojis/${unicode}"/>`;
|
||||
} 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 = `<svg class="custom-icon"><use xlink:href="#icon-${unicode}"></use></svg>`;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue