FIX: allows paste from context menu to work (#14061)
- uses keyDown for Enter event - input for other keys and pasting
This commit is contained in:
parent
ecb117df59
commit
c65822d47b
|
@ -7,7 +7,7 @@ import { searchContextDescription } from "discourse/lib/search";
|
||||||
createWidget("search-term", {
|
createWidget("search-term", {
|
||||||
tagName: "input",
|
tagName: "input",
|
||||||
buildId: () => "search-term",
|
buildId: () => "search-term",
|
||||||
buildKey: () => `search-term`,
|
buildKey: () => "search-term",
|
||||||
|
|
||||||
defaultState() {
|
defaultState() {
|
||||||
return { afterAutocomplete: false };
|
return { afterAutocomplete: false };
|
||||||
|
@ -23,12 +23,15 @@ createWidget("search-term", {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
keyUp(e) {
|
keyDown(e) {
|
||||||
if (e.which === 13 && !this.state.afterAutocomplete) {
|
if (e.key === "Enter" && !this.state.afterAutocomplete) {
|
||||||
return this.sendWidgetAction("fullSearch");
|
return this.sendWidgetAction("fullSearch");
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
input(e) {
|
||||||
const val = this.attrs.value;
|
const val = this.attrs.value;
|
||||||
|
|
||||||
// remove zero-width chars
|
// remove zero-width chars
|
||||||
const newVal = e.target.value.replace(/[\u200B-\u200D\uFEFF]/, "");
|
const newVal = e.target.value.replace(/[\u200B-\u200D\uFEFF]/, "");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue