feat(twemoji): add support for twemoji (#264)

This commit is contained in:
Dillon
2020-04-27 02:27:26 +08:00
committed by GitHub
parent fc46fba6aa
commit b46c81053f
26 changed files with 2297 additions and 2257 deletions

View File

@@ -42,7 +42,7 @@ class Theme {
this.clickMaskEventSet = new Set();
}
initIcon() {
initSVGIcon() {
this.util.forEach(document.querySelectorAll('[data-svg-src]'), $icon => {
fetch($icon.getAttribute('data-svg-src'))
.then(response => response.text())
@@ -58,6 +58,10 @@ class Theme {
});
}
initTwemoji() {
if (this.config.twemoji) twemoji.parse(document.body);
}
initMenuMobile() {
const $menuToggleMobile = document.getElementById('menu-toggle-mobile');
const $menuMobile = document.getElementById('menu-mobile');
@@ -638,7 +642,8 @@ class Theme {
}
init() {
this.initIcon();
this.initSVGIcon();
this.initTwemoji();
this.initMenuMobile();
this.initSwitchTheme();
this.initSearch();