fix(ui): Reset text-edit input value when pressing esc key to have matching input values (#3098)

This commit is contained in:
Alex Grozav 2022-04-14 10:30:31 +03:00 committed by GitHub
parent 176538e5f2
commit 29fdd77d7b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,7 +4,7 @@
<div class="ignore-key-press"> <div class="ignore-key-press">
<n8n-input-label :label="$locale.nodeText().inputLabelDisplayName(parameter, path)"> <n8n-input-label :label="$locale.nodeText().inputLabelDisplayName(parameter, path)">
<div @keydown.stop @keydown.esc="closeDialog()"> <div @keydown.stop @keydown.esc="onKeyDownEsc()">
<n8n-input v-model="tempValue" type="textarea" ref="inputField" :value="value" :placeholder="$locale.nodeText().placeholder(parameter, path)" @change="valueChanged" @keydown.stop="noOp" :rows="15" /> <n8n-input v-model="tempValue" type="textarea" ref="inputField" :value="value" :placeholder="$locale.nodeText().placeholder(parameter, path)" @change="valueChanged" @keydown.stop="noOp" :rows="15" />
</div> </div>
</n8n-input-label> </n8n-input-label>
@ -35,6 +35,13 @@ export default Vue.extend({
this.$emit('valueChanged', value); this.$emit('valueChanged', value);
}, },
onKeyDownEsc () {
// Resetting input value when closing the dialog, required when closing it using the `Esc` key
this.tempValue = this.value;
this.closeDialog();
},
closeDialog () { closeDialog () {
// Handle the close externally as the visible parameter is an external prop // Handle the close externally as the visible parameter is an external prop
// and is so not allowed to be changed here. // and is so not allowed to be changed here.