mirror of
https://github.com/zadam/trilium.git
synced 2025-12-21 15:49:56 +01:00
feat(print): support progress report on electron
This commit is contained in:
@@ -113,11 +113,17 @@ export default function NoteDetail() {
|
||||
useEffect(() => {
|
||||
if (!isElectron()) return;
|
||||
const { ipcRenderer } = dynamicRequire("electron");
|
||||
const listener = () => {
|
||||
toast.closePersistent("printing");
|
||||
const onPrintProgress = (_e: any, progress: number) => {
|
||||
console.log("Got print progress:", progress);
|
||||
showToast("printing", progress);
|
||||
};
|
||||
const onPrintDone = () => toast.closePersistent("printing");
|
||||
ipcRenderer.on("print-progress", onPrintProgress);
|
||||
ipcRenderer.on("print-done", onPrintDone);
|
||||
return () => {
|
||||
ipcRenderer.off("print-progress", onPrintProgress);
|
||||
ipcRenderer.off("print-done", onPrintDone);
|
||||
};
|
||||
ipcRenderer.on("print-done", listener);
|
||||
return () => ipcRenderer.off("print-done", listener);
|
||||
}, []);
|
||||
|
||||
useTriliumEvent("executeInActiveNoteDetailWidget", ({ callback }) => {
|
||||
|
||||
Reference in New Issue
Block a user