Skip to content

Commit

Permalink
🐛 Resetting text-edit input value when pressing esc key to have match…
Browse files Browse the repository at this point in the history
…ing input values.
  • Loading branch information
Alex Grozav authored and Alex Grozav committed Apr 6, 2022
1 parent 1b2e9be commit 5dc7fc2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/editor-ui/src/components/TextEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<div class="ignore-key-press">
<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" />
</div>
</n8n-input-label>
Expand Down Expand Up @@ -35,6 +35,13 @@ export default Vue.extend({
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 () {
// Handle the close externally as the visible parameter is an external prop
// and is so not allowed to be changed here.
Expand Down

0 comments on commit 5dc7fc2

Please sign in to comment.