Shivam Mishra
2024-10-02 13:06:30 +05:30
committed by GitHub
parent e0bf2bd9d4
commit 42f6621afb
661 changed files with 15939 additions and 31194 deletions

View File

@@ -13,7 +13,7 @@ export default {
type: String,
default: '',
},
value: {
modelValue: {
type: String,
default: '',
},
@@ -82,7 +82,7 @@ export default {
},
mounted() {
this.$nextTick(() => {
if (this.value) {
if (this.modelValue) {
this.resizeTextarea();
this.setCursor();
} else {
@@ -93,7 +93,7 @@ export default {
methods: {
resizeTextarea() {
this.$el.style.height = 'auto';
if (!this.value) {
if (!this.modelValue) {
this.$el.style.height = `${this.minHeight}rem`;
} else {
this.$el.style.height = `${this.$el.scrollHeight}px`;
@@ -104,9 +104,10 @@ export default {
// is supposed to be added, else we remove it.
toggleSignatureInEditor(signatureEnabled) {
const valueWithSignature = signatureEnabled
? appendSignature(this.value, this.cleanedSignature)
: removeSignature(this.value, this.cleanedSignature);
? appendSignature(this.modelValue, this.cleanedSignature)
: removeSignature(this.modelValue, this.cleanedSignature);
this.$emit('update:modelValue', valueWithSignature);
this.$emit('input', valueWithSignature);
this.$nextTick(() => {
@@ -116,7 +117,7 @@ export default {
},
setCursor() {
const bodyWithoutSignature = removeSignature(
this.value,
this.modelValue,
this.cleanedSignature
);
@@ -130,6 +131,7 @@ export default {
}
},
onInput(event) {
this.$emit('update:modelValue', event.target.value);
this.$emit('input', event.target.value);
this.resizeTextarea();
},
@@ -155,7 +157,7 @@ export default {
ref="textarea"
:placeholder="placeholder"
:rows="rows"
:value="value"
:value="modelValue"
@input="onInput"
@focus="onFocus"
@keyup="onKeyup"