fix: Handling markdown before replacing or appending signature [CW-2532] (#7944)

Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
This commit is contained in:
Shivam Mishra
2023-09-21 11:28:29 +05:30
committed by GitHub
parent f999777a2d
commit 27fc24375d
5 changed files with 39 additions and 29 deletions

View File

@@ -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);
@@ -157,7 +159,7 @@ export default {
this.$emit('focus');
},
focus() {
this.$refs.textarea.focus();
if (this.$refs.textarea) this.$refs.textarea.focus();
},
},
};