Skip to content

Commit 5156a33

Browse files
committed
fix: use textarea.value instead of textarea.textContent for setting and getting values
1 parent f1bde0c commit 5156a33

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

src/index.ts

+2-13
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ export default class CodeTool implements BlockTool {
188188
this._data = data;
189189

190190
if (this.nodes.textarea) {
191-
this.nodes.textarea.textContent = data.code;
191+
this.nodes.textarea.value = data.code;
192192
}
193193
}
194194

@@ -299,7 +299,7 @@ export default class CodeTool implements BlockTool {
299299

300300
wrapper.classList.add(this.CSS.baseClass, this.CSS.wrapper);
301301
textarea.classList.add(this.CSS.textarea, this.CSS.input);
302-
textarea.textContent = this.data.code;
302+
textarea.value = this.data.code;
303303

304304
textarea.placeholder = this.placeholder;
305305

@@ -317,17 +317,6 @@ export default class CodeTool implements BlockTool {
317317
case 'Tab':
318318
this.tabHandler(event);
319319
break;
320-
case 'Backspace':
321-
if (textarea.value.length > 0) {
322-
event.stopPropagation();
323-
}
324-
break;
325-
case 'ArrowUp':
326-
case 'ArrowDown':
327-
case 'ArrowLeft':
328-
case 'ArrowRight':
329-
event.stopPropagation();
330-
break;
331320
}
332321
});
333322

0 commit comments

Comments
 (0)