emoji picker
parent
1ed7ba87f2
commit
cf8dc31ad0
|
@ -164,6 +164,10 @@
|
|||
|
||||
import "https://cdn.jsdelivr.net/npm/emoji-picker-element@^1/index.js";
|
||||
import insertText from "https://cdn.jsdelivr.net/npm/insert-text-at-cursor@0.3.0/index.js";
|
||||
|
||||
document.getElementById("shx-emoji-picker-button").setAttribute("shx-emoji-picker-loaded", "true")
|
||||
|
||||
console.log("modules loaded")
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
@ -437,7 +441,7 @@
|
|||
<div class="field custom ">
|
||||
<input class="field__input" form="product-form-${section_id}" type="text" id="${inputID}" name="properties[${inputName}]" value="${(inputVal.length > maxLength ? inputVal.substring(0, maxLength) : inputVal)}" oninput="document.querySelector('shx-input-forms').renderView()" required maxlength="${maxLength}" normalMaxLength="${maxLength}">
|
||||
|
||||
<div onclick="document.querySelector('.shx-emoji-picker-popup').classList.toggle('shown')" style="position: absolute; right: 0; padding: 12px 10px 2px 12px; cursor: pointer" >
|
||||
<div id="shx-emoji-picker-button" shx-emoji-picker-loaded="false" onclick="document.querySelector('.shx-emoji-picker-popup').classList.toggle('shown')" style="position: absolute; right: 0; padding: 12px 10px 2px 12px; cursor: pointer" >
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#121212BF"><path d="M620-520q25 0 42.5-17.5T680-580q0-25-17.5-42.5T620-640q-25 0-42.5 17.5T560-580q0 25 17.5 42.5T620-520Zm-280 0q25 0 42.5-17.5T400-580q0-25-17.5-42.5T340-640q-25 0-42.5 17.5T280-580q0 25 17.5 42.5T340-520Zm140 260q68 0 123.5-38.5T684-400h-66q-22 37-58.5 58.5T480-320q-43 0-79.5-21.5T342-400h-66q25 63 80.5 101.5T480-260Zm0 180q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 320q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Z"/></svg>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1046,21 +1050,22 @@
|
|||
|
||||
this.renderView();
|
||||
|
||||
console.log("render current variant")
|
||||
console.log("render current variant", document.getElementById("shx-emoji-picker-button").getAttribute("shx-emoji-picker-loaded"))
|
||||
|
||||
const emojiPicker = document.createElement("emoji-picker");
|
||||
emojiPicker.classList = "light";
|
||||
emojiPicker.style.width = "100%";
|
||||
|
||||
emojiPicker.addEventListener("emoji-click", (e) => {
|
||||
console.log("insertText", e.detail.unicode)
|
||||
// insertText(document.querySelector("#shx-text1"), e.detail.unicode);
|
||||
});
|
||||
|
||||
console.log("loadEmojiPicker");
|
||||
|
||||
document.getElementsByClassName("shx-emoji-picker-popup")[0].appendChild(emojiPicker);
|
||||
|
||||
if (document.getElementById("shx-emoji-picker-button").getAttribute("shx-emoji-picker-loaded") === "true") {
|
||||
const emojiPicker = document.createElement("emoji-picker");
|
||||
emojiPicker.classList = "light";
|
||||
emojiPicker.style.width = "100%";
|
||||
|
||||
emojiPicker.addEventListener("emoji-click", (e) => {
|
||||
console.log("insertText", e.detail.unicode)
|
||||
// insertText(document.querySelector("#shx-text1"), e.detail.unicode);
|
||||
});
|
||||
|
||||
console.log("loadEmojiPicker");
|
||||
|
||||
document.getElementsByClassName("shx-emoji-picker-popup")[0].appendChild(emojiPicker);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue