This commit is contained in:
yoannchb-pro
2023-03-24 12:45:37 -04:00
parent 790fdb0722
commit ddffedc570
3 changed files with 18 additions and 1 deletions
+8
View File
@@ -338,6 +338,14 @@
return;
event.preventDefault();
input.textContent = response.slice(0, ++index);
//put the cursor at the end
input.focus();
const range = document.createRange();
range.selectNodeContents(input);
range.collapse(false);
const selection = window.getSelection();
selection.removeAllRanges();
selection.addRange(range);
});
}
else {
File diff suppressed because one or more lines are too long
+9
View File
@@ -20,6 +20,15 @@ function handleContentEditable(
if (index > response.length) return;
event.preventDefault();
input.textContent = response.slice(0, ++index);
//put the cursor at the end
input.focus();
const range = document.createRange();
range.selectNodeContents(input);
range.collapse(false);
const selection = window.getSelection();
selection.removeAllRanges();
selection.addRange(range);
});
} else {
input.textContent = response;