fix inline-emoji-search placement in chat

pull/211/head
Aevann 2023-09-29 07:10:55 +03:00
parent 636f30d0cf
commit 445f7c5598
3 changed files with 21 additions and 8 deletions

View File

@ -12,7 +12,7 @@ const socket = io()
const chatline = document.getElementsByClassName('chat-line')[0]
const box = document.getElementById('chat-window')
const ta = document.getElementById('input-text')
const ta = document.getElementById('input-text-chat')
const vid = document.getElementById('vid').value
const slurreplacer = document.getElementById('slurreplacer').value

View File

@ -332,7 +332,13 @@ let emoji_typing_state = false;
function update_ghost_div_textarea(text)
{
let ghostdiv = text.parentNode.querySelector(".ghostdiv");
let ghostdiv
if (location.pathname == '/chat')
ghostdiv = document.getElementById("ghostdiv-chat");
else
ghostdiv = text.parentNode.getElementsByClassName("ghostdiv")[0];
if (!ghostdiv) return;
ghostdiv.textContent = text.value.substring(0, text.selectionStart);
@ -517,10 +523,16 @@ function speed_carot_navigate(event)
function insertGhostDivs(element) {
let forms = element.querySelectorAll("textarea, .allow-emojis");
forms.forEach(i => {
let pseudo_div = document.createElement("div");
pseudo_div.className = "ghostdiv";
pseudo_div.style.display = "none";
i.after(pseudo_div);
let ghostdiv
if (i.id == 'input-text-chat') {
ghostdiv = document.getElementsByClassName("ghostdiv")[0];
}
else {
ghostdiv = document.createElement("div");
ghostdiv.className = "ghostdiv";
ghostdiv.style.display = "none";
i.after(ghostdiv);
}
i.addEventListener('input', update_speed_emoji_modal, false);
i.addEventListener('keydown', speed_carot_navigate, false);
});

View File

@ -326,7 +326,7 @@
<span id="loading-indicator" class="d-none"></span>
</div>
<span class="my-auto">
<i class="btn btn-secondary fas fa-smile-beam" style="font-size:1.3rem!important" data-nonce="{{g.nonce}}" data-onclick="loadEmojis('input-text')" data-bs-toggle="modal" data-bs-target="#emojiModal"></i>
<i class="btn btn-secondary fas fa-smile-beam" style="font-size:1.3rem!important" data-nonce="{{g.nonce}}" data-onclick="loadEmojis('input-text-chat')" data-bs-toggle="modal" data-bs-target="#emojiModal"></i>
</span>
<span class="my-auto ml-1">
@ -336,10 +336,11 @@
</label>
</span>
<textarea id="input-text" minlength="1" maxlength="{% if SITE == 'rdrama.net' %}200{% else %}1000{% endif %}" {% if g.browser in ("iphone","mac") %}style="font-size:16px!important"{% endif %} class="file-ta form-control" placeholder="Message" autocomplete="off" autofocus rows="1"></textarea>
<textarea id="input-text-chat" minlength="1" maxlength="{% if SITE == 'rdrama.net' %}200{% else %}1000{% endif %}" {% if g.browser in ("iphone","mac") %}style="font-size:16px!important"{% endif %} class="file-ta form-control" placeholder="Message" autocomplete="off" autofocus rows="1"></textarea>
<i id="chatsend" data-nonce="{{g.nonce}}" data-onclick="send()" class="btn btn-secondary fas fa-reply ml-3 my-auto" style="transform:rotateY(180deg);font-size:1.3rem!important"></i>
</div>
<div id="ghostdiv-chat" class="ghostdiv" style="display: none"><span></span></div>
</div>
{% endmacro %}