Allow Inline Emoji modal in more areas (#318)

* Sneed

* Bust cache
remotes/1693045480750635534/spooky-22
Nekobit 2022-07-17 01:42:03 -04:00 committed by GitHub
parent 544f1b6ee6
commit bde47271d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 21 additions and 13 deletions

View File

@ -777,6 +777,9 @@
{"name":"sharkysad","class":"Users"},
{"name":"sharkythink","class":"Users"},
{"name":"ivoted", "tags":["democracy", "spider"],"class":"Misc"},
{"name":"hapyday", "tags":["happyday", "wholesome", "smile"],"class":"Misc"},
{"name":"froth", "tags":["froth", "seethe", "angry", "ugh", "frothing", "sneed"],"class":"Misc"},
{"name":"chadyescapy", "tags":["capy", "aevann"],"class":"Misc"},
{"name":"chadnocapy", "tags":["capy", "aevann"],"class":"Misc"},
{"name":"capygitcommit", "tags":["capy", "aevann"],"class":"Misc"},

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -406,6 +406,8 @@ function emojiAddToInput(event)
speed_carot_modal.style.display = "none";
document.body.appendChild(speed_carot_modal);
let e
let current_word = "";
let emojo_index = 0;
@ -458,8 +460,6 @@ function emojiAddToInput(event)
function update_speed_emoji_modal(event)
{
if (event.target.tagName.toLowerCase() !== 'textarea') return;
const box_coords = update_ghost_div_textarea(event.target);
let text = event.target.value;
@ -504,11 +504,8 @@ function emojiAddToInput(event)
}
}
// Update emoji position
document.addEventListener('input', update_speed_emoji_modal, false);
// Update emoji position
document.addEventListener('keydown', (e) => {
function speed_carot_navigate(e)
{
let select_items = speed_carot_modal.querySelectorAll(".speed-modal-option");
if (!select_items || !curr_word_is_emoji()) return false;
// Up or down arrow or enter
@ -516,7 +513,7 @@ function emojiAddToInput(event)
{
if (emojo_index > select_items.length)
emojo_index = select_items;
select_items[emojo_index].classList.remove("selected");
switch (e.keyCode)
{
@ -539,7 +536,17 @@ function emojiAddToInput(event)
select_items[emojo_index].classList.add("selected");
e.preventDefault();
}
}, false);
}
// Let's get it running now
let forms = document.querySelectorAll("textarea, .allow-emojis");
forms.forEach(i => {
let pseudo_div = document.createElement("div");
pseudo_div.className = "ghostdiv";
i.after(pseudo_div);
i.addEventListener('input', update_speed_emoji_modal, false);
i.addEventListener('keydown', speed_carot_navigate, false);
});
})();

View File

@ -552,7 +552,6 @@
<input type="hidden" name="parent_fullname" value="{{c.fullname}}">
<input autocomplete="off" id="reply-form-submission-{{c.fullname}}" type="hidden" name="submission" value="{{c.post.id}}">
<textarea required autocomplete="off" {% if v.longpost %}minlength="280"{% else %}minlength="1"{% endif %} maxlength="{% if v.bird %}140{% else %}10000{% endif %}" oninput="markdown('reply-form-body-{{c.fullname}}', 'reply-edit-{{c.id}}');charLimit('reply-form-body-{{c.fullname}}','charcount-{{c.id}}')" id="reply-form-body-{{c.fullname}}" data-fullname="{{c.fullname}}" name="body" form="reply-to-t3_{{c.id}}" class="comment-box form-control rounded" aria-label="With textarea" placeholder="Add your comment..." rows="3"></textarea>
<div class="ghostdiv" style="display:none;"></div>
<div class="text-small font-weight-bold mt-1" id="charcount-{{c.id}}" style="right: 1rem; bottom: 0.5rem; z-index: 3;"></div>

View File

@ -983,7 +983,6 @@
<input type="hidden" name="parent_fullname" value="t2_{{p.id}}">
<input autocomplete="off" id="reply-form-submission-{{p.fullname}}" type="hidden" name="submission" value="{{p.id}}">
<textarea required autocomplete="off" {% if not (p and p.id in ADMIGGERS) %}{% if v.longpost %}minlength="280"{% elif v.bird %}maxlength="140"{% endif %}{% endif %} minlength="1" maxlength="10000" oninput="markdown('reply-form-body-{{p.fullname}}', 'form-preview-{{p.id}}');charLimit('reply-form-body-{{p.fullname}}','charcount-reply')" id="reply-form-body-{{p.fullname}}" data-fullname="{{p.fullname}}" class="comment-box form-control rounded" id="comment-form" name="body" form="reply-to-{{p.fullname}}" aria-label="With textarea" placeholder="Add your comment..." rows="3"></textarea>
<div class="ghostdiv" style="display:none;"></div>
<div class="text-small font-weight-bold mt-1" id="charcount-reply" style="right: 1rem; bottom: 0.5rem; z-index: 3;"></div>

View File

@ -100,7 +100,7 @@
<label class='mt-4' for="title">Post Title</label>
<input autocomplete="off" class="form-control" id="post-title" aria-describedby="titleHelpRegister" type="text" name="title" placeholder="Required" value="{{title}}" minlength="1" maxlength="500" required oninput="checkForRequired();savetext()">
<input autocomplete="off" class="form-control allow-emojis" id="post-title" aria-describedby="titleHelpRegister" type="text" name="title" placeholder="Required" value="{{title}}" minlength="1" maxlength="500" required oninput="checkForRequired();savetext()">
<div onclick="loadEmojis('post-title')" class="btn btn-secondary format d-inline-block m-0" id="emoji-reply-btn-2" aria-hidden="true" data-bs-toggle="modal" data-bs-target="#emojiModal" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Add Emoji"><i class="fas fa-smile-beam"></i></div>

View File

@ -39,4 +39,4 @@ set CACHE_VER = {
{%- macro asset_siteimg(name) -%}
/i/{{SITE_NAME}}/{{name}}?v=3001
{%- endmacro -%}
{%- endmacro -%}