Skip to content

Commit

Permalink
fix: use textarea.value instead of textarea.textContent for setting a…
Browse files Browse the repository at this point in the history
…nd getting values
  • Loading branch information
idebenone committed Nov 18, 2024
1 parent f1bde0c commit 5156a33
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export default class CodeTool implements BlockTool {
this._data = data;

if (this.nodes.textarea) {
this.nodes.textarea.textContent = data.code;
this.nodes.textarea.value = data.code;
}
}

Expand Down Expand Up @@ -299,7 +299,7 @@ export default class CodeTool implements BlockTool {

wrapper.classList.add(this.CSS.baseClass, this.CSS.wrapper);
textarea.classList.add(this.CSS.textarea, this.CSS.input);
textarea.textContent = this.data.code;
textarea.value = this.data.code;

textarea.placeholder = this.placeholder;

Expand All @@ -317,17 +317,6 @@ export default class CodeTool implements BlockTool {
case 'Tab':
this.tabHandler(event);
break;
case 'Backspace':
if (textarea.value.length > 0) {
event.stopPropagation();
}
break;
case 'ArrowUp':
case 'ArrowDown':
case 'ArrowLeft':
case 'ArrowRight':
event.stopPropagation();
break;
}
});

Expand Down

0 comments on commit 5156a33

Please sign in to comment.