Skip to content

Commit

Permalink
try to fix the shitty select all inserthtml lag
Browse files Browse the repository at this point in the history
  • Loading branch information
Concedo authored and Concedo committed Dec 7, 2023
1 parent c19e56d commit cd3bcdd
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3636,6 +3636,17 @@
window.clipboardData
? window.clipboardData.getData('Text')
: '';

let elem = document.getElementById("gametext")
let selection = window.getSelection();
let fullySelected = (elem.innerText!="" && selection.toString() === elem.innerText);
if(fullySelected)
{
document.execCommand('selectAll', false, null);
document.execCommand('insertText', false, "");
elem.innerHTML = "";
}

text = escapeHtml(text);
text = text.replace(/\r?\n/g, '<br>');
document.execCommand("insertHTML", false, text);
Expand Down

0 comments on commit cd3bcdd

Please sign in to comment.