Fixed pasting issue where only 2500 chars are being pasted to the SendLargeMessages modal
This commit is contained in:
parent
be2b0ac1a4
commit
ad86a86306
|
@ -63,7 +63,7 @@ class SendLargeMessages {
|
||||||
|
|
||||||
getDescription () {return "Opens a popout when your message is too large, which allows you to automatically send the message in several smaller messages.";}
|
getDescription () {return "Opens a popout when your message is too large, which allows you to automatically send the message in several smaller messages.";}
|
||||||
|
|
||||||
getVersion () {return "1.4.7";}
|
getVersion () {return "1.4.8";}
|
||||||
|
|
||||||
getAuthor () {return "DevilBro";}
|
getAuthor () {return "DevilBro";}
|
||||||
|
|
||||||
|
@ -89,6 +89,8 @@ class SendLargeMessages {
|
||||||
if (typeof BDFDB === "object") {
|
if (typeof BDFDB === "object") {
|
||||||
BDFDB.loadMessage(this);
|
BDFDB.loadMessage(this);
|
||||||
|
|
||||||
|
this.clipboard = require("electron").clipboard;
|
||||||
|
|
||||||
this.bindEventToTextArea();
|
this.bindEventToTextArea();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -119,25 +121,27 @@ class SendLargeMessages {
|
||||||
}
|
}
|
||||||
|
|
||||||
bindEventToTextArea () {
|
bindEventToTextArea () {
|
||||||
var checkTextarea = (textarea, text) => {
|
var modaltext, checkTextarea = (textarea) => {
|
||||||
if (BDFDB.getParsedLength(text) > 1950) {
|
if (BDFDB.getParsedLength(textarea.value) > 1950) {
|
||||||
textarea.selectionStart = 0;
|
textarea.selectionStart = 0;
|
||||||
textarea.selectionEnd = textarea.value.length;
|
textarea.selectionEnd = textarea.value.length;
|
||||||
document.execCommand("insertText", false, "");
|
document.execCommand("insertText", false, "");
|
||||||
this.showSendModal(text);
|
this.showSendModal(modaltext);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$(BDFDB.dotCNS.textareawrapchat + "textarea")
|
$(BDFDB.dotCNS.textareawrapchat + "textarea")
|
||||||
.off("input." + this.getName())
|
.off("input." + this.getName())
|
||||||
.on("input." + this.getName(), e => {
|
.on("input." + this.getName(), e => {
|
||||||
clearTimeout(e.currentTarget.sendlargemessagestimeout);
|
clearTimeout(e.currentTarget.sendlargemessagestimeout);
|
||||||
e.currentTarget.sendlargemessagestimeout = setTimeout(() => {checkTextarea(e.currentTarget, e.currentTarget.value);},100);
|
e.currentTarget.sendlargemessagestimeout = setTimeout(() => {
|
||||||
|
modaltext = e.currentTarget.value;
|
||||||
|
checkTextarea(e.currentTarget);
|
||||||
|
},100);
|
||||||
})
|
})
|
||||||
.off("paste." + this.getName())
|
.off("paste." + this.getName())
|
||||||
.on("paste." + this.getName(), e => {
|
.on("paste." + this.getName(), e => {
|
||||||
setImmediate(() => {
|
modaltext = e.currentTarget.value.slice(0, e.currentTarget.selectionStart) + this.clipboard.readText() + e.currentTarget.value.slice(e.currentTarget.selectionEnd);
|
||||||
checkTextarea(e.currentTarget, e.currentTarget.value);
|
setImmediate(() => {checkTextarea(e.currentTarget);});
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue