diff --git a/snippets/shx-3d-render-input.liquid b/snippets/shx-3d-render-input.liquid index 8a1f85f..b180212 100644 --- a/snippets/shx-3d-render-input.liquid +++ b/snippets/shx-3d-render-input.liquid @@ -417,19 +417,19 @@ } function onClickEmojiPickerButton() { - if (document.getElementsByClassName("shx-emoji-picker-popup")[0].childNodes.length > 0) return + if (document.getElementsByClassName("shx-emoji-picker-popup")[0].childNodes.length === 0) { + const emojiPicker = document.createElement("emoji-picker"); + emojiPicker.classList = "light"; + emojiPicker.style.width = "100%"; - const emojiPicker = document.createElement("emoji-picker"); - emojiPicker.classList = "light"; - emojiPicker.style.width = "100%"; + emojiPicker.addEventListener("emoji-click", (e) => { + insertText(document.querySelector("#shx-text1"), e.detail.unicode); + }); - emojiPicker.addEventListener("emoji-click", (e) => { - insertText(document.querySelector("#shx-text1"), e.detail.unicode); - }); + console.log("add picker"); - console.log("add picker"); - - document.getElementsByClassName("shx-emoji-picker-popup")[0].appendChild(emojiPicker); + document.getElementsByClassName("shx-emoji-picker-popup")[0].appendChild(emojiPicker); + } document.querySelector('.shx-emoji-picker-popup').classList.toggle('shown') }