mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-13 07:30:50 +08:00
🐛 自定义表情搜索报错 Fix https://github.com/siyuan-note/siyuan/issues/5883
This commit is contained in:
parent
00533d95ac
commit
cbfec5172d
@ -25,6 +25,7 @@ export const unicode2Emoji = (unicode: string, assic = false) => {
|
|||||||
if (unicode.indexOf(".") > -1) {
|
if (unicode.indexOf(".") > -1) {
|
||||||
emoji = `<img src="/emojis/${unicode}"/>`;
|
emoji = `<img src="/emojis/${unicode}"/>`;
|
||||||
} else if (isMobile() || window.siyuan.config.appearance.nativeEmoji || assic) {
|
} else if (isMobile() || window.siyuan.config.appearance.nativeEmoji || assic) {
|
||||||
|
try {
|
||||||
unicode.split("-").forEach(item => {
|
unicode.split("-").forEach(item => {
|
||||||
if (item.length < 5) {
|
if (item.length < 5) {
|
||||||
emoji += String.fromCodePoint(parseInt("0" + item, 16));
|
emoji += String.fromCodePoint(parseInt("0" + item, 16));
|
||||||
@ -32,6 +33,10 @@ export const unicode2Emoji = (unicode: string, assic = false) => {
|
|||||||
emoji += String.fromCodePoint(parseInt(item, 16));
|
emoji += String.fromCodePoint(parseInt(item, 16));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} catch (e) {
|
||||||
|
// 自定义表情搜索报错 https://github.com/siyuan-note/siyuan/issues/5883
|
||||||
|
// 这里忽略错误不做处理
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
emoji = `<svg class="custom-icon"><use xlink:href="#icon-${unicode}"></use></svg>`;
|
emoji = `<svg class="custom-icon"><use xlink:href="#icon-${unicode}"></use></svg>`;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user