compose: Improve tooltip on compose box "x" button.

In compose box, the "x" button tooltip text changed to
"Cancel compose and save draft" except when unsent
message length is short(<3).

Also in help(?) > keyboard shortcuts, text for `Esc`
changed to "Cancel compose and save draft".

The help center page updated with the above changes.

Fixes #21599.
This commit is contained in:
Yogesh
2022-07-29 18:00:39 +05:30
committed by Tim Abbott
parent 45743ea195
commit b8a760b14e
5 changed files with 15 additions and 5 deletions

View File

@@ -412,7 +412,14 @@ export function initialize() {
$("#compose-textarea").on("input propertychange", () => {
compose_validate.warn_if_topic_resolved(false);
compose_validate.check_overflow_text();
const compose_text_length = compose_validate.check_overflow_text();
// Change compose close button tooltip as per condition.
// We save compose text in draft only if its length is > 2.
if (compose_text_length > 2) {
$("#compose_close").attr("data-tooltip-template-id", "compose_close_and_save_tooltip");
} else {
$("#compose_close").attr("data-tooltip-template-id", "compose_close_tooltip");
}
});
$("#compose form").on("submit", (e) => {