mirror of
https://github.com/JOYCEQL/magic-resume.git
synced 2026-07-03 14:07:11 +02:00
Merge remote-tracking branch 'origin/feat/more-font'
# Conflicts: # src/components/shared/PdfExport.tsx # src/utils/print.ts
This commit is contained in:
@@ -137,7 +137,7 @@ const TemplateThumbnail = ({
|
||||
height: "297mm",
|
||||
transform: `scale(${scale})`,
|
||||
padding: `${template.spacing?.contentPadding || 32}px`,
|
||||
fontFamily: "Alibaba PuHuiTi, sans-serif",
|
||||
fontFamily: previewData.globalSettings?.fontFamily || "Alibaba PuHuiTi, sans-serif",
|
||||
}}
|
||||
>
|
||||
<ResumeTemplateComponent
|
||||
|
||||
@@ -40,22 +40,22 @@ const buildTemplatePreviewData = (
|
||||
selectedColor: string,
|
||||
mockId: string
|
||||
) =>
|
||||
({
|
||||
...baseData,
|
||||
id: mockId,
|
||||
templateId: template.id,
|
||||
globalSettings: {
|
||||
...baseData.globalSettings,
|
||||
themeColor: selectedColor || template.colorScheme.primary,
|
||||
sectionSpacing: template.spacing.sectionGap,
|
||||
paragraphSpacing: template.spacing.itemGap,
|
||||
pagePadding: template.spacing.contentPadding,
|
||||
},
|
||||
basic: {
|
||||
...baseData.basic,
|
||||
layout: template.basic.layout,
|
||||
},
|
||||
} as any);
|
||||
({
|
||||
...baseData,
|
||||
id: mockId,
|
||||
templateId: template.id,
|
||||
globalSettings: {
|
||||
...baseData.globalSettings,
|
||||
themeColor: selectedColor || template.colorScheme.primary,
|
||||
sectionSpacing: template.spacing.sectionGap,
|
||||
paragraphSpacing: template.spacing.itemGap,
|
||||
pagePadding: template.spacing.contentPadding,
|
||||
},
|
||||
basic: {
|
||||
...baseData.basic,
|
||||
layout: template.basic.layout,
|
||||
},
|
||||
} as any);
|
||||
|
||||
interface TemplateCardItemProps {
|
||||
index: number;
|
||||
@@ -138,7 +138,7 @@ const TemplateCardItem = ({
|
||||
transform: `scale(${scale})`,
|
||||
transformOrigin: "top left",
|
||||
padding: `${template.spacing.contentPadding}px`,
|
||||
fontFamily: "Alibaba PuHuiTi, sans-serif",
|
||||
fontFamily: previewData.globalSettings?.fontFamily || "Alibaba PuHuiTi, sans-serif",
|
||||
}}
|
||||
>
|
||||
<ResumeTemplateComponent data={previewData} template={template} />
|
||||
@@ -352,7 +352,7 @@ const TemplatesPage = () => {
|
||||
transform: `scale(${PREVIEW_MODAL_SCALE})`,
|
||||
transformOrigin: "top left",
|
||||
padding: `${activePreviewTemplate.spacing.contentPadding}px`,
|
||||
fontFamily: "Alibaba PuHuiTi, sans-serif",
|
||||
fontFamily: selectedColor ? `Alibaba PuHuiTi, sans-serif` : `Alibaba PuHuiTi, sans-serif`, // Base on standard since it's just a general preview
|
||||
}}
|
||||
>
|
||||
<ResumeTemplateComponent
|
||||
|
||||
@@ -111,9 +111,9 @@ export function SidePanel() {
|
||||
}, [availableModules, menuSections]);
|
||||
|
||||
const fontOptions = [
|
||||
{ value: "sans", label: t("typography.font.sans") },
|
||||
{ value: "serif", label: t("typography.font.serif") },
|
||||
{ value: "mono", label: t("typography.font.mono") },
|
||||
{ value: "Alibaba PuHuiTi, sans-serif", label: t("typography.font.alibaba") },
|
||||
{ value: "\"Microsoft YaHei\", \"微软雅黑\", sans-serif", label: t("typography.font.msyahei") },
|
||||
{ value: "\"Noto Serif SC\", \"Source Han Serif SC\", serif", label: t("typography.font.notoserifsc") },
|
||||
];
|
||||
|
||||
const lineHeightOptions = [
|
||||
@@ -280,12 +280,12 @@ export function SidePanel() {
|
||||
{/* 排版设置 */}
|
||||
<SettingCard icon={Type} title={t("typography.title")}>
|
||||
<div className="space-y-6">
|
||||
{/* <div className="space-y-2">
|
||||
<div className="space-y-2">
|
||||
<Label className="text-muted-foreground">
|
||||
{t('typography.font.title')}
|
||||
</Label>
|
||||
<Select
|
||||
value={globalSettings?.fontFamily}
|
||||
value={globalSettings?.fontFamily || "Alibaba PuHuiTi, sans-serif"}
|
||||
onValueChange={(value) =>
|
||||
updateGlobalSettings?.({ fontFamily: value })
|
||||
}
|
||||
@@ -314,7 +314,7 @@ export function SidePanel() {
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div> */}
|
||||
</div>
|
||||
|
||||
{/* 行高选择 */}
|
||||
<div className="space-y-2">
|
||||
|
||||
@@ -10,14 +10,14 @@ import { ResumeTemplate } from "../../types/template";
|
||||
|
||||
const IframeTemplateViewer = () => {
|
||||
const { id } = useParams({ from: "/app/preview-template/$id" });
|
||||
|
||||
|
||||
// Use cookie to determine locale
|
||||
const locale =
|
||||
typeof document !== "undefined"
|
||||
? document.cookie
|
||||
.split("; ")
|
||||
.find((row) => row.startsWith("NEXT_LOCALE="))
|
||||
?.split("=")[1] || "zh"
|
||||
.split("; ")
|
||||
.find((row) => row.startsWith("NEXT_LOCALE="))
|
||||
?.split("=")[1] || "zh"
|
||||
: "zh";
|
||||
|
||||
const template = useMemo(() => {
|
||||
@@ -55,7 +55,7 @@ const IframeTemplateViewer = () => {
|
||||
"relative mx-auto origin-top-left"
|
||||
)}
|
||||
style={{
|
||||
fontFamily: "Alibaba PuHuiTi, sans-serif",
|
||||
fontFamily: mockData.globalSettings?.fontFamily || "Alibaba PuHuiTi, sans-serif",
|
||||
padding: `${template.spacing.contentPadding}px`,
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -181,7 +181,7 @@ const PreviewPanel = React.forwardRef<HTMLDivElement, PreviewPanelProps>(
|
||||
ref={previewRef}
|
||||
className="relative w-full h-full bg-gray-100"
|
||||
style={{
|
||||
fontFamily: "Alibaba PuHuiTi, sans-serif",
|
||||
fontFamily: activeResume.globalSettings?.fontFamily || "Alibaba PuHuiTi, sans-serif",
|
||||
}}
|
||||
>
|
||||
<div className="py-4 ml-4 px-4 min-h-screen flex justify-center scale-[58%] origin-top md:scale-90 md:origin-top-left">
|
||||
|
||||
@@ -89,7 +89,7 @@ const TemplatePreview = ({
|
||||
transformOrigin: "top left",
|
||||
boxSizing: "border-box",
|
||||
padding: `${template.spacing.contentPadding}px`,
|
||||
fontFamily: "Alibaba PuHuiTi, sans-serif",
|
||||
fontFamily: baseData.globalSettings?.fontFamily || "Alibaba PuHuiTi, sans-serif",
|
||||
}}
|
||||
>
|
||||
<ResumeTemplateComponent
|
||||
|
||||
@@ -329,9 +329,9 @@
|
||||
"title": "Typography",
|
||||
"font": {
|
||||
"title": "Font",
|
||||
"sans": "Sans-serif",
|
||||
"serif": "Serif",
|
||||
"mono": "Monospace"
|
||||
"alibaba": "Alibaba PuHuiTi",
|
||||
"msyahei": "Microsoft YaHei",
|
||||
"notoserifsc": "Noto Serif SC"
|
||||
},
|
||||
"lineHeight": {
|
||||
"title": "Line Height",
|
||||
|
||||
@@ -289,9 +289,9 @@
|
||||
"title": "排版",
|
||||
"font": {
|
||||
"title": "字体",
|
||||
"sans": "无衬线体",
|
||||
"serif": "衬线体",
|
||||
"mono": "等宽体"
|
||||
"alibaba": "阿里巴巴普惠体",
|
||||
"msyahei": "微软雅黑",
|
||||
"notoserifsc": "思源宋体"
|
||||
},
|
||||
"lineHeight": {
|
||||
"title": "行高",
|
||||
|
||||
+1
-1
@@ -127,7 +127,7 @@ export const exportResumeToBrowserPrint = async (resumeContent: HTMLElement, pag
|
||||
const printWhenReady = async () => {
|
||||
try {
|
||||
const doc = iframeWindow.document;
|
||||
|
||||
|
||||
// 等待字体加载
|
||||
if (doc.fonts?.ready) {
|
||||
await doc.fonts.ready;
|
||||
|
||||
Reference in New Issue
Block a user