fix: emoji shortcodes
This commit is contained in:
parent
570a290954
commit
24cf61c783
7 changed files with 39 additions and 17 deletions
|
@ -1146,28 +1146,25 @@ secondary=false) -%}
|
|||
<script>
|
||||
document
|
||||
.querySelector("emoji-picker")
|
||||
.addEventListener("emoji-click", (event) => {
|
||||
function gemoji() {
|
||||
const use_first_shortcode = [
|
||||
"grinning squinting face",
|
||||
"smiling_face_with_heart_eyes",
|
||||
];
|
||||
.addEventListener("emoji-click", async (event) => {
|
||||
if (event.detail.skinTone > 0) {
|
||||
document.getElementById(
|
||||
window.EMOJI_PICKER_TEXT_ID,
|
||||
).value += event.detail.unicode;
|
||||
|
||||
if (
|
||||
use_first_shortcode.includes(
|
||||
event.detail.emoji.annotation,
|
||||
) ||
|
||||
!event.detail.emoji.shortcodes[1]
|
||||
) {
|
||||
return event.detail.emoji.shortcodes[0];
|
||||
}
|
||||
|
||||
return event.detail.emoji.shortcodes[1];
|
||||
document.getElementById("emoji_dialog").close();
|
||||
return;
|
||||
}
|
||||
|
||||
document.getElementById(
|
||||
window.EMOJI_PICKER_TEXT_ID,
|
||||
).value += ` :${gemoji()}:`;
|
||||
).value += ` :${await (
|
||||
await fetch("/api/v1/lookup_emoji", {
|
||||
method: "POST",
|
||||
body: event.detail.unicode,
|
||||
})
|
||||
).text()}:`;
|
||||
|
||||
document.getElementById("emoji_dialog").close();
|
||||
});
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue