From dd2b3ca6896b36502d1b89b632803fde3d6832ac 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 8285bc60..87539e59 100644 --- a/asset/js/widget/TermInput.js +++ b/asset/js/widget/TermInput.js @@ -162,6 +162,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;