Skip to content

Commit

Permalink
fix(ui): Reset text-edit input value when pressing esc key to have ma…
Browse files Browse the repository at this point in the history
…tching input values (#3098)
  • Loading branch information
alexgrozav committed Apr 14, 2022
1 parent 176538e commit 29fdd77
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 29fdd77

Please sign in to comment.