saved_snippets: Move "Saved snippets" button to compose control buttons.

This is follow-up of #31359 that moves "Saved snippets" button from
"send_later" popover to message formatting buttons and adds support
to use saved snippets in message-edit UI.

Fixes #31830.
This commit is contained in:
Vector73
2025-01-29 06:58:37 +00:00
committed by Tim Abbott
parent c69b119666
commit 91ddfdadd6
6 changed files with 28 additions and 16 deletions

View File

@@ -37,6 +37,7 @@ export type Option = {
export type DropdownWidgetOptions = {
widget_name: string;
widget_selector?: string;
// You can bold the selected `option` by setting `option.bold_current_selection` to `true`.
// Currently, not implemented for stream names.
get_options: (current_value: string | number | undefined) => Option[];
@@ -103,7 +104,7 @@ export class DropdownWidget {
constructor(options: DropdownWidgetOptions) {
this.widget_name = options.widget_name;
this.widget_selector = `#${CSS.escape(this.widget_name)}_widget`;
this.widget_selector = options.widget_selector ?? `#${CSS.escape(this.widget_name)}_widget`;
// A widget wrapper may not exist based on the UI requirement.
this.widget_wrapper_id = `${this.widget_selector}_wrapper`;
this.widget_value_selector = `${this.widget_selector} .dropdown_widget_value`;