drafts: Replace notification when saving a draft.

The old logic, inline in the compose area, has produced a very weird
effect where the buttons would move to fit the notification, ever
since design changes to use the full bottom row space.

We address this by just using a Tippy tooltip instead.
This commit is contained in:
Tim Abbott
2021-05-11 14:56:59 -07:00
parent c95cac2dd7
commit 6a374d6d28
3 changed files with 12 additions and 11 deletions

View File

@@ -1,6 +1,7 @@
import {subDays} from "date-fns";
import Handlebars from "handlebars/runtime";
import $ from "jquery";
import tippy from "tippy.js";
import render_draft_table_body from "../templates/draft_table_body.hbs";
@@ -137,8 +138,17 @@ export function restore_message(draft) {
}
function draft_notify() {
$(".alert-draft").css("display", "inline-block");
$(".alert-draft").delay(1000).fadeOut(500);
// Display a tooltip to notify the user about the saved draft.
const instance = tippy(".compose_drafts_button", {
content: $t({defaultMessage: "Saved as draft"}),
arrow: true,
placement: "top",
})[0];
instance.show();
function remove_instance() {
instance.destroy();
}
setTimeout(remove_instance, 1500);
}
export function update_draft() {