message_edit: Add message length limit indicator in edit message UI.

Adds a message length limit indicator similar to the one in the compose box.
The tooltip message for the disabled save button now appears dynamically
based on whether the message exceeds the length limit or the editing time
has expired.

Fixes #25271.
This commit is contained in:
opmkumar
2024-12-04 07:53:41 +05:30
committed by Tim Abbott
parent 88727862b4
commit 5eb51e2df6
7 changed files with 108 additions and 17 deletions

View File

@@ -6,6 +6,7 @@ import render_message_edit_notice_tooltip from "../templates/message_edit_notice
import render_message_inline_image_tooltip from "../templates/message_inline_image_tooltip.hbs";
import render_narrow_tooltip from "../templates/narrow_tooltip.hbs";
import * as compose_validate from "./compose_validate.ts";
import {$t} from "./i18n.ts";
import * as message_lists from "./message_lists.ts";
import type {Message} from "./message_store.ts";
@@ -282,6 +283,19 @@ export function initialize(): void {
},
});
message_list_tooltip(".disabled-message-edit-save", {
onShow(instance) {
const $elem = $(instance.reference);
const $row = $elem.closest(".message_row");
assert($row !== undefined);
instance.setContent(compose_validate.get_disabled_save_tooltip($row));
return undefined;
},
onHidden(instance) {
instance.destroy();
},
});
message_list_tooltip(".recipient_row_date > span", {
onHidden(instance) {
instance.destroy();