forked from rDrama/rDrama
Fix adding several marseys in place
parent
79b3b0dfc1
commit
b59e7bcf0f
|
@ -23,14 +23,14 @@
|
||||||
commentFormID = form;
|
commentFormID = form;
|
||||||
};
|
};
|
||||||
|
|
||||||
const TEXTAREA_POS = 'curr-pos'
|
const TEXTAREA_POS_ATTR = 'data-curr-pos'
|
||||||
|
|
||||||
// Insert EMOJI markdown into comment box function
|
// Insert EMOJI markdown into comment box function
|
||||||
|
|
||||||
function getEmoji(searchTerm, form) {
|
function getEmoji(searchTerm, form) {
|
||||||
const commentBox = document.getElementById(form);
|
const commentBox = document.getElementById(form);
|
||||||
const old = commentBox.value;
|
const old = commentBox.value;
|
||||||
const curPos = commentBox.getAttribute('data-' + TEXTAREA_POS);
|
const curPos = parseInt(commentBox.getAttribute(TEXTAREA_POS_ATTR));
|
||||||
|
|
||||||
const firstHalf = old.slice(0, curPos)
|
const firstHalf = old.slice(0, curPos)
|
||||||
const lastHalf = old.slice(curPos)
|
const lastHalf = old.slice(curPos)
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
|
|
||||||
const newPos = curPos + emoji.length
|
const newPos = curPos + emoji.length
|
||||||
|
|
||||||
commentBox.setAttribute('data-' + TEXTAREA_POS, newPos);
|
commentBox.setAttribute(TEXTAREA_POS_ATTR, newPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadEmojis(form) {
|
function loadEmojis(form) {
|
||||||
|
@ -92,7 +92,7 @@
|
||||||
container.innerHTML = container.innerHTML.replace(/@form@/g, form)
|
container.innerHTML = container.innerHTML.replace(/@form@/g, form)
|
||||||
|
|
||||||
const commentBox = document.getElementById(form);
|
const commentBox = document.getElementById(form);
|
||||||
commentBox.setAttribute('data-' + TEXTAREA_POS, commentBox.selectionStart);
|
commentBox.setAttribute(TEXTAREA_POS_ATTR, commentBox.selectionStart);
|
||||||
|
|
||||||
for (i=0; i < emojis.length; i++) {
|
for (i=0; i < emojis.length; i++) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue