forked from rDrama/rDrama
make "reply" button a "quote" button
parent
39cedb5f2d
commit
4e7a9dc37b
|
@ -52,25 +52,22 @@ function getSelectionTextHtml() {
|
||||||
function toggleReplyBox(id) {
|
function toggleReplyBox(id) {
|
||||||
const element = document.getElementById(id);
|
const element = document.getElementById(id);
|
||||||
const ta = element.getElementsByTagName('textarea')[0]
|
const ta = element.getElementsByTagName('textarea')[0]
|
||||||
element.classList.toggle('d-none')
|
element.classList.remove('d-none')
|
||||||
|
|
||||||
if (!element.classList.contains('d-none'))
|
let text = getSelection().toString().trim()
|
||||||
|
if (text)
|
||||||
{
|
{
|
||||||
let text = getSelection().toString().trim()
|
text = '> ' + text
|
||||||
if (text)
|
text = text.replace(/\n/g,"\n> ")
|
||||||
{
|
text = text.replace(/\n> \n/g,"\n \n")
|
||||||
text = '> ' + text
|
text = text.split('> Reply')[0]
|
||||||
text = text.replace(/\n/g,"\n> ")
|
text = text.replace(/\*/g,"\\*")
|
||||||
text = text.replace(/\n> \n/g,"\n \n")
|
|
||||||
text = text.split('> Reply')[0]
|
|
||||||
text = text.replace(/\*/g,"\\*")
|
|
||||||
|
|
||||||
if (ta.value && !ta.value.endsWith('\n')) ta.value += '\n'
|
if (ta.value && !ta.value.endsWith('\n')) ta.value += '\n'
|
||||||
ta.value += text
|
ta.value += text
|
||||||
if (!ta.value.endsWith('\n')) ta.value += '\n'
|
if (!ta.value.endsWith('\n')) ta.value += '\n'
|
||||||
}
|
|
||||||
ta.focus()
|
|
||||||
}
|
}
|
||||||
|
ta.focus()
|
||||||
|
|
||||||
autoExpand(ta);
|
autoExpand(ta);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue