diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json index a6858c7d6..d09d2742f 100644 --- a/apps/client/src/translations/en/translation.json +++ b/apps/client/src/translations/en/translation.json @@ -1722,7 +1722,8 @@ "window-on-top": "Keep Window on Top" }, "note_detail": { - "could_not_find_typewidget": "Could not find typeWidget for type '{{type}}'" + "could_not_find_typewidget": "Could not find typeWidget for type '{{type}}'", + "printing": "Printing in progress..." }, "note_title": { "placeholder": "type note's title here..." diff --git a/apps/client/src/widgets/note_detail.ts b/apps/client/src/widgets/note_detail.ts index 472c4aeea..0c1255d39 100644 --- a/apps/client/src/widgets/note_detail.ts +++ b/apps/client/src/widgets/note_detail.ts @@ -33,6 +33,7 @@ import type { NoteType } from "../entities/fnote.js"; import type TypeWidget from "./type_widgets/type_widget.js"; import { MermaidTypeWidget } from "./type_widgets/mermaid.js"; import AiChatTypeWidget from "./type_widgets/ai_chat.js"; +import toast from "../services/toast.js"; const TPL = /*html*/`
@@ -297,6 +298,11 @@ export default class NoteDetailWidget extends NoteContextAwareWidget { return; } + toast.showPersistent({ + icon: "bx bx-loader-circle bx-spin", + message: t("note_detail.printing"), + id: "printing" + }); const iframe = document.createElement('iframe'); iframe.src = `?print#${this.notePath}`; iframe.className = "print-iframe"; @@ -304,6 +310,7 @@ export default class NoteDetailWidget extends NoteContextAwareWidget { iframe.onload = () => { if (!iframe.contentWindow) return; iframe.contentWindow.addEventListener("note-ready", () => { + toast.closePersistent("printing"); iframe.contentWindow?.print(); document.body.removeChild(iframe); });