diff --git a/app/src/config/bazaar.ts b/app/src/config/bazaar.ts index 697a7f0ca..5b268eaa3 100644 --- a/app/src/config/bazaar.ts +++ b/app/src/config/bazaar.ts @@ -123,7 +123,10 @@ export const bazaar = {
- +
+ + +
@@ -147,7 +150,10 @@ export const bazaar = {
- +
+ + +
@@ -171,7 +177,10 @@ export const bazaar = {
- +
+ + +
@@ -195,7 +204,10 @@ export const bazaar = {
- +
+ + +
@@ -219,7 +231,10 @@ export const bazaar = {
- +
+ + +
@@ -877,6 +892,49 @@ export const bazaar = { } }); + bazaar.element.querySelectorAll(".bazaarPanel .b3-form__icon > .b3-text-field").forEach((inputElement: HTMLInputElement) => { + inputElement.addEventListener("keydown", (event) => { + if (event.isComposing) { + return; + } + if (event.key === "Enter") { + const keyword = inputElement.value.trim(); + const type = (hasClosestByClassName(inputElement, "bazaarPanel") as HTMLElement).getAttribute("data-type"); + if (type === "template") { + fetchPost("/api/bazaar/getBazaarTemplate", {keyword}, response => { + bazaar._onBazaar(response, "templates", false); + bazaar._data.templates = response.data.packages; + }); + } else if (type === "icon") { + fetchPost("/api/bazaar/getBazaarIcon", {keyword}, response => { + bazaar._onBazaar(response, "icons", false); + bazaar._data.icons = response.data.packages; + }); + } else if (type === "widget") { + fetchPost("/api/bazaar/getBazaarWidget", {keyword}, response => { + bazaar._onBazaar(response, "widgets", false); + bazaar._data.widgets = response.data.packages; + }); + } else if (type === "theme") { + fetchPost("/api/bazaar/getBazaarTheme", {keyword}, response => { + bazaar._onBazaar(response, "themes", false); + bazaar._data.themes = response.data.packages; + }); + } else if (type === "plugin") { + fetchPost("/api/bazaar/getBazaarPlugin", { + frontend: getFrontend(), + keyword + }, response => { + bazaar._onBazaar(response, "plugins", false); + bazaar._data.plugins = response.data.packages; + }); + } + event.preventDefault(); + return; + } + }) + }); + bazaar.element.querySelectorAll(".b3-select").forEach((selectElement: HTMLSelectElement) => { selectElement.addEventListener("change", (event) => { if (selectElement.id === "bazaarSelect") {