feat: 实现 Web 与 Desktop DOCX 导出交互
This commit is contained in:
+19
-10
@@ -17,6 +17,7 @@ import {
|
||||
DesktopApplicationController
|
||||
} from "./desktop-application-controller.js";
|
||||
import { DESKTOP_PDF_PARTITION } from "./electron-pdf-generator.js";
|
||||
import { DESKTOP_DOCX_PARTITION } from "./electron-docx-media-engine.js";
|
||||
import {
|
||||
findMarkdownFileArgument,
|
||||
isMarkdownFilePath
|
||||
@@ -182,6 +183,9 @@ async function registerApplicationProtocol(
|
||||
protocol.handle(APP_SCHEME, handleRequest),
|
||||
session
|
||||
.fromPartition(DESKTOP_PDF_PARTITION)
|
||||
.protocol.handle(APP_SCHEME, handleRequest),
|
||||
session
|
||||
.fromPartition(DESKTOP_DOCX_PARTITION)
|
||||
.protocol.handle(APP_SCHEME, handleRequest)
|
||||
]);
|
||||
}
|
||||
@@ -219,16 +223,16 @@ if (!hasSingleInstanceLock) {
|
||||
return;
|
||||
}
|
||||
event.preventDefault();
|
||||
void applicationController.flushWindowState().finally(() => {
|
||||
windowStateReadyToQuit = true;
|
||||
app.quit();
|
||||
setTimeout(() => {
|
||||
windowStateReadyToQuit = false;
|
||||
}, 1_000);
|
||||
});
|
||||
});
|
||||
app.on("will-quit", () => {
|
||||
void applicationController?.closeResources();
|
||||
void Promise.all([
|
||||
applicationController.flushWindowState(),
|
||||
applicationController.closeResources()
|
||||
]).finally(() => {
|
||||
windowStateReadyToQuit = true;
|
||||
app.quit();
|
||||
setTimeout(() => {
|
||||
windowStateReadyToQuit = false;
|
||||
}, 1_000);
|
||||
});
|
||||
});
|
||||
app
|
||||
.whenReady()
|
||||
@@ -260,6 +264,11 @@ if (!hasSingleInstanceLock) {
|
||||
currentDirectory,
|
||||
"pdf-preload.cjs"
|
||||
),
|
||||
docxRenderUrl: new URL(
|
||||
"/preview-frame.html?target=continuous",
|
||||
applicationUrl
|
||||
).href,
|
||||
desktopResourcesPath: process.resourcesPath,
|
||||
iconPath: getApplicationIcon(),
|
||||
themeDirectory,
|
||||
windowStatePath: path.join(
|
||||
|
||||
Reference in New Issue
Block a user