mirror of
https://github.com/zadam/trilium.git
synced 2025-12-21 07:39:55 +01:00
feat(print): display progress in toast
This commit is contained in:
@@ -139,11 +139,7 @@ export default function NoteDetail() {
|
||||
useTriliumEvent("printActiveNote", () => {
|
||||
if (!noteContext?.isActive() || !note) return;
|
||||
|
||||
toast.showPersistent({
|
||||
icon: "bx bx-loader-circle bx-spin",
|
||||
message: t("note_detail.printing"),
|
||||
id: "printing"
|
||||
});
|
||||
showToast("printing");
|
||||
|
||||
if (isElectron()) {
|
||||
const { ipcRenderer } = dynamicRequire("electron");
|
||||
@@ -163,7 +159,7 @@ export default function NoteDetail() {
|
||||
}
|
||||
|
||||
iframe.contentWindow.addEventListener("note-load-progress", (e) => {
|
||||
console.log("Got ", e);
|
||||
showToast("printing", e.detail.progress);
|
||||
});
|
||||
|
||||
iframe.contentWindow.addEventListener("note-ready", () => {
|
||||
@@ -326,3 +322,12 @@ function checkFullHeight(noteContext: NoteContext | undefined, type: ExtendedNot
|
||||
|| noteContext?.viewScope?.viewMode === "attachments"
|
||||
|| isBackendNote;
|
||||
}
|
||||
|
||||
function showToast(type: "printing" | "exporting_pdf", progress: number = 0) {
|
||||
toast.showPersistent({
|
||||
icon: "bx bx-loader-circle bx-spin",
|
||||
message: t("note_detail.printing"),
|
||||
id: "printing",
|
||||
progress
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user