fix: safer access to textarea
This commit is contained in:
@@ -113,7 +113,6 @@ export default {
|
||||
});
|
||||
},
|
||||
setCursor() {
|
||||
const textarea = this.$refs.textarea;
|
||||
const bodyWithoutSignature = removeSignature(
|
||||
this.value,
|
||||
this.cleanedSignature
|
||||
@@ -121,9 +120,12 @@ export default {
|
||||
|
||||
// only trim at end, so if there are spaces at the start, those are not removed
|
||||
const bodyEndsAt = bodyWithoutSignature.trimEnd().length;
|
||||
const textarea = this.$refs.textarea;
|
||||
|
||||
textarea.focus();
|
||||
textarea.setSelectionRange(bodyEndsAt, bodyEndsAt);
|
||||
if (textarea) {
|
||||
textarea.focus();
|
||||
textarea.setSelectionRange(bodyEndsAt, bodyEndsAt);
|
||||
}
|
||||
},
|
||||
onInput(event) {
|
||||
this.$emit('input', event.target.value);
|
||||
|
||||
Reference in New Issue
Block a user