From a9ee49ed141d4d2c2a65eb2b484c7f1a550b4036 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;