From 66e8bfe18ce7778ac9cc84976e494b30ba692bf0 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Sun, 13 Oct 2024 11:29:53 +0800 Subject: [PATCH] Move emojis check condition to top --- src/utils/enhance-content.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/utils/enhance-content.js b/src/utils/enhance-content.js index bbb2b840..b8a5357f 100644 --- a/src/utils/enhance-content.js +++ b/src/utils/enhance-content.js @@ -116,13 +116,11 @@ function _enhanceContent(content, opts = {}) { // ====== // Convert :shortcode: to let textNodes; - if (enhancedContent.includes(':')) { + if (enhancedContent.includes(':') && emojis?.length) { textNodes = extractTextNodes(dom); for (const node of textNodes) { let html = escapeHTML(node.nodeValue); - if (emojis) { - html = emojifyText(html, emojis); - } + html = emojifyText(html, emojis); fauxDiv.innerHTML = html; node.replaceWith(...fauxDiv.childNodes); }