compose: Add utility function to clear all compose banners.

This commit is contained in:
N-Shar-ma 2023-04-25 04:37:48 +05:30 committed by Tim Abbott
parent 6608f2b211
commit ff8d209807
2 changed files with 5 additions and 3 deletions

View File

@ -65,6 +65,10 @@ export function clear_warnings(): void {
$(`#compose_banners .${CSS.escape(WARNING)}`).remove();
}
export function clear_all(): void {
$(`#compose_banners`).empty();
}
export function show_error_message(message: string, classname: string, $bad_input?: JQuery): void {
$(`#compose_banners .${CSS.escape(classname)}`).remove();

View File

@ -310,9 +310,7 @@ export function process_escape_key(e) {
// Check for errors in compose box; close errors if they exist
if ($(".compose_banner").length) {
compose_banner.clear_message_sent_banners();
compose_banner.clear_errors();
compose_banner.clear_warnings();
compose_banner.clear_all();
return true;
}