invite_stream_picker_pill: Hide typeahead after backspacing a pill.

Include `hide_on_empty_after_backspace` when
passing opts to `set_up_streams`

Fixes: #30542.
This commit is contained in:
Sanchit Sharma 2024-07-17 21:47:41 +05:30 committed by Tim Abbott
parent afe9ac7900
commit 6dba4cf943
2 changed files with 4 additions and 0 deletions

View File

@ -28,6 +28,7 @@ function create_item_from_stream_name(
function set_up_pill_typeahead({pill_widget, $pill_container}: SetUpPillTypeaheadConfig): void {
const opts = {
help_on_empty_strings: true,
hide_on_empty_after_backspace: true,
invite_streams: true,
};
set_up_stream($pill_container.find(".input"), pill_widget, opts);

View File

@ -76,6 +76,7 @@ export function set_up_stream(
pills: StreamPillWidget,
opts: {
help_on_empty_strings?: boolean;
hide_on_empty_after_backspace?: boolean;
invite_streams?: boolean;
update_func?: () => void;
},
@ -85,9 +86,11 @@ export function set_up_stream(
type: "contenteditable",
};
opts.help_on_empty_strings ??= false;
opts.hide_on_empty_after_backspace ??= false;
new Typeahead(bootstrap_typeahead_input, {
dropup: true,
helpOnEmptyStrings: opts.help_on_empty_strings,
hideOnEmptyAfterBackspace: opts.hide_on_empty_after_backspace,
source(_query: string): StreamPillData[] {
return stream_pill.typeahead_source(pills, opts.invite_streams);
},