mirror of https://github.com/zulip/zulip.git
bootstrap_typeahead: Remove fixed argument.
Tippy uses a different strategy for positioning items, so this will not be required.
This commit is contained in:
parent
12984c9cef
commit
689489573a
|
@ -209,7 +209,6 @@ export class Typeahead<ItemType extends string | object> {
|
|||
$header: JQuery;
|
||||
source: (query: string, input_element: TypeaheadInputElement) => ItemType[];
|
||||
dropup: boolean;
|
||||
fixed: boolean;
|
||||
automated: () => boolean;
|
||||
trigger_selection: (event: JQuery.KeyDownEvent) => boolean;
|
||||
on_escape?: () => void;
|
||||
|
@ -248,7 +247,6 @@ export class Typeahead<ItemType extends string | object> {
|
|||
this.$header = $(HEADER_ELEMENT_HTML).appendTo(this.$container);
|
||||
this.source = options.source;
|
||||
this.dropup = options.dropup ?? false;
|
||||
this.fixed = options.fixed ?? false;
|
||||
this.automated = options.automated ?? (() => false);
|
||||
this.trigger_selection = options.trigger_selection ?? (() => false);
|
||||
this.on_escape = options.on_escape;
|
||||
|
@ -266,9 +264,6 @@ export class Typeahead<ItemType extends string | object> {
|
|||
this.parentElement = options.parentElement;
|
||||
this.values = new WeakMap();
|
||||
|
||||
if (this.fixed) {
|
||||
this.$container.css("position", "fixed");
|
||||
}
|
||||
// The naturalSearch option causes arrow keys to immediately
|
||||
// update the search box with the underlying values from the
|
||||
// search suggestions.
|
||||
|
@ -329,12 +324,7 @@ export class Typeahead<ItemType extends string | object> {
|
|||
if (this.parentElement === undefined) {
|
||||
let pos;
|
||||
|
||||
if (this.fixed) {
|
||||
// Relative to screen instead of to page
|
||||
pos = this.input_element.$element[0].getBoundingClientRect();
|
||||
} else {
|
||||
pos = this.input_element.$element.offset();
|
||||
}
|
||||
pos = this.input_element.$element[0].getBoundingClientRect();
|
||||
|
||||
pos = $.extend({}, pos, {
|
||||
height: this.input_element.$element[0].offsetHeight,
|
||||
|
@ -709,7 +699,6 @@ type TypeaheadOptions<ItemType> = {
|
|||
automated?: () => boolean;
|
||||
closeInputFieldOnHide?: () => void;
|
||||
dropup?: boolean;
|
||||
fixed?: boolean;
|
||||
header_html?: () => string | false;
|
||||
helpOnEmptyStrings?: boolean;
|
||||
matcher?: (item: ItemType, query: string) => boolean;
|
||||
|
|
|
@ -1109,7 +1109,6 @@ export function initialize_topic_edit_typeahead(form_field, stream_name, dropup)
|
|||
type: "input",
|
||||
};
|
||||
return new Typeahead(bootstrap_typeahead_input, {
|
||||
fixed: true,
|
||||
dropup,
|
||||
highlighter_html(item) {
|
||||
return typeahead_helper.render_typeahead_item({primary: item});
|
||||
|
@ -1161,7 +1160,6 @@ export function initialize_compose_typeahead(selector) {
|
|||
new Typeahead(bootstrap_typeahead_input, {
|
||||
items: max_num_items,
|
||||
dropup: true,
|
||||
fixed: true,
|
||||
// Performance note: We have trivial matcher/sorters to do
|
||||
// matching and sorting inside the `source` field to avoid
|
||||
// O(n) behavior in the number of users in the organization
|
||||
|
@ -1196,7 +1194,6 @@ export function initialize({on_enter_send}) {
|
|||
return topics_seen_for(compose_state.stream_id());
|
||||
},
|
||||
items: 3,
|
||||
fixed: true,
|
||||
highlighter_html(item) {
|
||||
return typeahead_helper.render_typeahead_item({primary: item});
|
||||
},
|
||||
|
@ -1224,7 +1221,6 @@ export function initialize({on_enter_send}) {
|
|||
source: get_pm_people,
|
||||
items: max_num_items,
|
||||
dropup: true,
|
||||
fixed: true,
|
||||
highlighter_html(item) {
|
||||
return typeahead_helper.render_person_or_user_group(item);
|
||||
},
|
||||
|
|
|
@ -172,7 +172,6 @@ export function initialize_custom_pronouns_type_fields(element_id) {
|
|||
};
|
||||
new Typeahead(bootstrap_typeahead_input, {
|
||||
items: 3,
|
||||
fixed: true,
|
||||
helpOnEmptyStrings: true,
|
||||
source() {
|
||||
return commonly_used_pronouns;
|
||||
|
|
|
@ -55,7 +55,6 @@ export function set_up(
|
|||
};
|
||||
new Typeahead(bootstrap_typeahead_input, {
|
||||
items: 5,
|
||||
fixed: true,
|
||||
dropup: true,
|
||||
source(query: string): TypeaheadItem[] {
|
||||
let source: TypeaheadItem[] = [];
|
||||
|
|
|
@ -170,7 +170,6 @@ function build_page(): void {
|
|||
return [...language_labels.keys()];
|
||||
},
|
||||
items: 5,
|
||||
fixed: true,
|
||||
helpOnEmptyStrings: true,
|
||||
highlighter_html: (item: string): string =>
|
||||
render_typeahead_item({primary: language_labels.get(item)}),
|
||||
|
|
|
@ -162,7 +162,6 @@ run_test("set_up", ({mock_template, override, override_rewire}) => {
|
|||
override(bootstrap_typeahead, "Typeahead", (input_element, config) => {
|
||||
assert.equal(input_element.$element, $fake_input);
|
||||
assert.equal(config.items, 5);
|
||||
assert.ok(config.fixed);
|
||||
assert.ok(config.dropup);
|
||||
assert.ok(config.stopAdvance);
|
||||
|
||||
|
|
Loading…
Reference in New Issue