Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/CorePluginsAdmin/vue/src/FormField/FieldTextareaArray.vue')
-rw-r--r--plugins/CorePluginsAdmin/vue/src/FormField/FieldTextareaArray.vue28
1 files changed, 19 insertions, 9 deletions
diff --git a/plugins/CorePluginsAdmin/vue/src/FormField/FieldTextareaArray.vue b/plugins/CorePluginsAdmin/vue/src/FormField/FieldTextareaArray.vue
index 510f0f68d7..59a46fefad 100644
--- a/plugins/CorePluginsAdmin/vue/src/FormField/FieldTextareaArray.vue
+++ b/plugins/CorePluginsAdmin/vue/src/FormField/FieldTextareaArray.vue
@@ -24,8 +24,9 @@
</template>
<script lang="ts">
-import { defineComponent, nextTick } from 'vue';
+import { defineComponent } from 'vue';
import { debounce } from 'CoreHome';
+import AbortableModifiers from './AbortableModifiers';
const SEPARATOR = '\n';
@@ -35,6 +36,7 @@ export default defineComponent({
title: String,
uiControlAttributes: Object,
modelValue: [Array, String],
+ modelModifiers: Object,
},
inheritAttrs: false,
emits: ['update:modelValue'],
@@ -54,15 +56,23 @@ export default defineComponent({
onKeydown(event: KeyboardEvent) {
const value = (event.target as HTMLTextAreaElement).value.split(SEPARATOR);
if (value.join(SEPARATOR) !== this.concattedValue) {
- this.$emit('update:modelValue', value);
+ if (!(this.modelModifiers as AbortableModifiers)?.abortable) {
+ this.$emit('update:modelValue', value);
+ return;
+ }
- nextTick(() => {
- if ((event.target as HTMLInputElement).value !== this.concattedValue) {
- // change to previous value if the parent component did not update the model value
- // (done manually because Vue will not notice if a value does NOT change)
- (event.target as HTMLInputElement).value = this.concattedValue;
- }
- });
+ const emitEventData = {
+ value,
+ abort: () => {
+ if ((event.target as HTMLInputElement).value !== this.concattedValue) {
+ // change to previous value if the parent component did not update the model value
+ // (done manually because Vue will not notice if a value does NOT change)
+ (event.target as HTMLInputElement).value = this.concattedValue;
+ }
+ },
+ };
+
+ this.$emit('update:modelValue', emitEventData);
}
},
},