edit_linkifier: Fix multiple modals opening.

Earlier the `edit` button was still in focus even after opening the
modal. This caused the modal to open multiple times when the user
pressed the enter key. This commit fixes that issue by placing the
carat at the end of the first input field when the modal is opened.
This commit is contained in:
Kenneth Rodrigues 2024-07-17 23:56:21 +05:30 committed by Tim Abbott
parent 37725e4e9f
commit 87ff793b5a
1 changed files with 4 additions and 0 deletions

View File

@ -16,6 +16,7 @@ import * as scroll_util from "./scroll_util";
import * as settings_ui from "./settings_ui";
import {current_user, realm} from "./state_data";
import * as ui_report from "./ui_report";
import * as ui_util from "./ui_util";
type RealmLinkifiers = typeof realm.realm_linkifiers;
@ -106,6 +107,9 @@ function open_linkifier_edit_form(linkifier_id: number): void {
on_click() {
submit_linkifier_form(dialog_widget_id);
},
on_shown() {
ui_util.place_caret_at_end($("#edit-linkifier-pattern")[0]!);
},
});
}