feat: 实现 DOCX 可编辑字体嵌入
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
type RenderedMarkdownDocument,
|
||||
type ThemeManifest
|
||||
} from "@md-to-pdf/core";
|
||||
import type { DocxFontSource } from "@md-to-pdf/docx-engine";
|
||||
import {
|
||||
createThemeRegistry,
|
||||
type ThemeRegistryOptions
|
||||
@@ -48,6 +49,7 @@ export interface PreparedDocxExport {
|
||||
manifest: ThemeManifest;
|
||||
source: "bundled" | "local";
|
||||
css: string;
|
||||
fonts: DocxFontSource[];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -186,11 +188,12 @@ export function createApplicationService(
|
||||
);
|
||||
}
|
||||
|
||||
const [document, themeCss] = await Promise.all([
|
||||
const [document, themeCss, themeFonts] = await Promise.all([
|
||||
render(parsed.data, context),
|
||||
themes.getCss(theme.manifest.id)
|
||||
themes.getCss(theme.manifest.id),
|
||||
themes.getDocxFonts(theme.manifest.id)
|
||||
]);
|
||||
if (themeCss === undefined) {
|
||||
if (themeCss === undefined || themeFonts === undefined) {
|
||||
throw new ApplicationRequestError(
|
||||
404,
|
||||
"THEME_NOT_FOUND",
|
||||
@@ -204,7 +207,8 @@ export function createApplicationService(
|
||||
theme: {
|
||||
manifest: theme.manifest,
|
||||
source: theme.source,
|
||||
css: themeCss
|
||||
css: themeCss,
|
||||
fonts: themeFonts
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user