Tweak handleInput function for better handling of textareas

This commit is contained in:
Aljaž Grilc 2024-03-28 07:59:55 +01:00
parent f29d6732c3
commit 8d1e9681f6

View File

@ -758,6 +758,7 @@ class BesTAService {
lines.forEach(line => {
const divEl = document.createElement('div')
divEl.textContent = line
if (line === '') divEl.innerHTML = ' '
this.cloneDiv.appendChild(divEl)
})
this.cloneDiv.dispatchEvent(customEvent)
@ -787,7 +788,7 @@ class BesTAService {
/**
* This function handles the replacement of the text in the textarea element
*
* @param {HTMLElement} el Element to replace the text in
* @param {HTMLElement} el Element whose outerText will be used as a replacement
*/
handleReplacement(el) {
// TODO: think of a way to reposition the cursor after the replacement