mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-02 06:06:41 +01:00
Move emojis check condition to top
This commit is contained in:
parent
82163c0b88
commit
66e8bfe18c
1 changed files with 2 additions and 4 deletions
|
@ -116,13 +116,11 @@ function _enhanceContent(content, opts = {}) {
|
||||||
// ======
|
// ======
|
||||||
// Convert :shortcode: to <img />
|
// Convert :shortcode: to <img />
|
||||||
let textNodes;
|
let textNodes;
|
||||||
if (enhancedContent.includes(':')) {
|
if (enhancedContent.includes(':') && emojis?.length) {
|
||||||
textNodes = extractTextNodes(dom);
|
textNodes = extractTextNodes(dom);
|
||||||
for (const node of textNodes) {
|
for (const node of textNodes) {
|
||||||
let html = escapeHTML(node.nodeValue);
|
let html = escapeHTML(node.nodeValue);
|
||||||
if (emojis) {
|
html = emojifyText(html, emojis);
|
||||||
html = emojifyText(html, emojis);
|
|
||||||
}
|
|
||||||
fauxDiv.innerHTML = html;
|
fauxDiv.innerHTML = html;
|
||||||
node.replaceWith(...fauxDiv.childNodes);
|
node.replaceWith(...fauxDiv.childNodes);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue