mirror of
https://github.com/Nystik-gh/ignis.git
synced 2026-06-17 04:35:53 +00:00
shim pdf print
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "obsidian-bridge",
|
||||
"name": "Ignis",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"description": "Self-hosted Obsidian via Electron API shimming",
|
||||
"description": "An Electron shim and server bridge for running Obsidian in a browser.",
|
||||
"scripts": {
|
||||
"build:shims": "node build.js",
|
||||
"dev:server": "node server/index.js",
|
||||
|
||||
@@ -157,6 +157,15 @@ export const ipcRenderer = {
|
||||
handleRequestUrl(requestId, request);
|
||||
return;
|
||||
}
|
||||
|
||||
if (channel === "print-to-pdf") {
|
||||
const [options] = args;
|
||||
window.print();
|
||||
queueMicrotask(() => {
|
||||
ipcRenderer._emit("print-to-pdf", { success: true });
|
||||
});
|
||||
return;
|
||||
}
|
||||
},
|
||||
|
||||
sendSync(channel, ...args) {
|
||||
|
||||
@@ -5,10 +5,18 @@ export const dialogShim = {
|
||||
return { canceled: true, filePaths: [] };
|
||||
},
|
||||
|
||||
// TODO: replace prompt() with a styled modal (matching vault manager style)
|
||||
async showSaveDialog(browserWindow, options) {
|
||||
// TODO: implement custom modal
|
||||
console.log("[shim:dialog] showSaveDialog (stub):", options);
|
||||
return { canceled: true, filePath: undefined };
|
||||
if (typeof browserWindow === "object" && !options) {
|
||||
options = browserWindow;
|
||||
}
|
||||
const defaultName =
|
||||
options?.defaultPath?.split(/[/\\]/).pop() || "download";
|
||||
const name = prompt("Save as:", defaultName);
|
||||
if (!name) {
|
||||
return { canceled: true, filePath: undefined };
|
||||
}
|
||||
return { canceled: false, filePath: "/downloads/" + name };
|
||||
},
|
||||
|
||||
async showMessageBox(browserWindow, options) {
|
||||
|
||||
@@ -165,6 +165,13 @@ const currentWebContents = {
|
||||
this._windowOpenHandler = handler;
|
||||
},
|
||||
|
||||
printToPDF(options) {
|
||||
return new Promise((resolve) => {
|
||||
window.print();
|
||||
resolve(Buffer.from([]));
|
||||
});
|
||||
},
|
||||
|
||||
capturePage(rect) {
|
||||
// TODO: could use html2canvas
|
||||
console.log("[shim:webContents] capturePage (stub)");
|
||||
|
||||
Reference in New Issue
Block a user