From 58168480537d76556014b91621331e7a1b276831 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 17 Apr 2023 16:35:22 +0200 Subject: [PATCH] TermInput: Handle `Enter` just like a normal exchange --- asset/js/widget/TermInput.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/asset/js/widget/TermInput.js b/asset/js/widget/TermInput.js index fff518b9..c33e8f10 100644 --- a/asset/js/widget/TermInput.js +++ b/asset/js/widget/TermInput.js @@ -161,6 +161,22 @@ define(["BaseInput"], function (BaseInput) { } } } + + onButtonClick(event) { + if (! this.hasSyntaxError()) { + let addedTerms = this.exchangeTerm(); + if (Object.keys(addedTerms).length) { + this.togglePlaceholder(); + event.preventDefault(); + this.autoSubmit(this.input, 'exchange', addedTerms); + this.ignoreSpaceUntil = null; + + return; + } + } + + super.onButtonClick(event); + } } return TermInput;