mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
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:
@@ -7,7 +7,7 @@ import { searchContextDescription } from "discourse/lib/search";
|
||||
createWidget("search-term", {
|
||||
tagName: "input",
|
||||
buildId: () => "search-term",
|
||||
buildKey: () => `search-term`,
|
||||
buildKey: () => "search-term",
|
||||
|
||||
defaultState() {
|
||||
return { afterAutocomplete: false };
|
||||
@@ -23,12 +23,15 @@ createWidget("search-term", {
|
||||
};
|
||||
},
|
||||
|
||||
keyUp(e) {
|
||||
if (e.which === 13 && !this.state.afterAutocomplete) {
|
||||
keyDown(e) {
|
||||
if (e.key === "Enter" && !this.state.afterAutocomplete) {
|
||||
return this.sendWidgetAction("fullSearch");
|
||||
}
|
||||
},
|
||||
|
||||
input(e) {
|
||||
const val = this.attrs.value;
|
||||
|
||||
// remove zero-width chars
|
||||
const newVal = e.target.value.replace(/[\u200B-\u200D\uFEFF]/, "");
|
||||
|
||||
|
Reference in New Issue
Block a user