diff --git a/asset/js/widget/TermInput.js b/asset/js/widget/TermInput.js index 8ab26fc9..34ec69a9 100644 --- a/asset/js/widget/TermInput.js +++ b/asset/js/widget/TermInput.js @@ -143,13 +143,13 @@ define(["../notjQuery", "BaseInput"], function ($, BaseInput) { } let input = event.target; - switch (event.key) { - case '"': - case "'": - if (this.ignoreSpaceUntil === null) { - this.ignoreSpaceUntil = event.key; - this.ignoreSpaceSince = input.selectionStart - 1; - } + let firstChar = this.readPartialTerm(input).charAt(0); + + if (firstChar === "'" || firstChar === '"') { + if (this.ignoreSpaceUntil === null) { + this.ignoreSpaceUntil = firstChar; + this.ignoreSpaceSince = input.selectionStart - 1; + } } } @@ -198,6 +198,9 @@ define(["../notjQuery", "BaseInput"], function ($, BaseInput) { // Register current input value, otherwise it's not included this.exchangeTerm(); event.preventDefault(); + + this.ignoreSpaceUntil = null; + this.ignoreSpaceSince = null; } } }