bootstrap_typeahead: Remove create and lookup API.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2024-05-06 13:31:24 -07:00
committed by Tim Abbott
parent acf93eac4b
commit 7360fd2a67
9 changed files with 32 additions and 37 deletions

View File

@@ -3,6 +3,7 @@ import $ from "jquery";
import render_confirm_delete_playground from "../templates/confirm_dialog/confirm_delete_playground.hbs";
import render_admin_playground_list from "../templates/settings/admin_playground_list.hbs";
import {Typeahead} from "./bootstrap_typeahead";
import * as bootstrap_typeahead from "./bootstrap_typeahead";
import type {TypeaheadInputElement} from "./bootstrap_typeahead";
import * as channel from "./channel";
@@ -17,6 +18,8 @@ import {current_user, realm} from "./state_data";
import {render_typeahead_item} from "./typeahead_helper";
import * as ui_report from "./ui_report";
let pygments_typeahead: Typeahead<string>;
const meta = {
loaded: false,
};
@@ -161,7 +164,7 @@ function build_page(): void {
type: "input",
};
bootstrap_typeahead.create(bootstrap_typeahead_input, {
pygments_typeahead = new Typeahead(bootstrap_typeahead_input, {
source(query: string): string[] {
language_labels = realm_playground.get_pygments_typeahead_list_for_settings(query);
return [...language_labels.keys()];
@@ -181,7 +184,7 @@ function build_page(): void {
});
$search_pygments_box.on("click", (e) => {
bootstrap_typeahead.lookup($search_pygments_box);
pygments_typeahead.lookup(false);
$search_pygments_box.trigger("select");
e.preventDefault();
e.stopPropagation();