21 lines
693 B
JavaScript
21 lines
693 B
JavaScript
const { contextBridge, ipcRenderer } = require("electron");
|
|
|
|
ipcRenderer.on("qoffice:command", (_event, command) => {
|
|
if (typeof command === "string") {
|
|
window.dispatchEvent(new CustomEvent("qoffice-command", { detail: { command } }));
|
|
}
|
|
});
|
|
|
|
contextBridge.exposeInMainWorld("qoffice", {
|
|
isDesktop: true,
|
|
platform: process.platform,
|
|
openOfficeFile: (kind) => ipcRenderer.invoke("qoffice:open-office-file", kind),
|
|
saveOfficeFile: (kind, defaultFileName, base64Data) =>
|
|
ipcRenderer.invoke("qoffice:save-office-file", {
|
|
kind,
|
|
defaultFileName,
|
|
base64Data
|
|
}),
|
|
exportPdf: (defaultFileName) => ipcRenderer.invoke("qoffice:export-pdf", defaultFileName)
|
|
});
|