Skip to content

Commit

Permalink
TermInput: Handle spaces between quotes correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
sukhwinder33445 committed Sep 6, 2022
1 parent 691e831 commit 78e82b7
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions asset/js/widget/TermInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}

Expand Down Expand Up @@ -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;
}
}
}
Expand Down

0 comments on commit 78e82b7

Please sign in to comment.