Skip to content

Commit af2c567

Browse files
committed
feat: add margin input to export options and update i18n translations
1 parent 0663f1e commit af2c567

3 files changed

Lines changed: 26 additions & 1 deletion

File tree

web/src/App.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,14 @@ const handleExport = async (options) => {
7272
ignoreImage: options.ignoreImage,
7373
ignoreFootnote: options.ignoreFootnote,
7474
ignoreHtml: options.ignoreHtml,
75-
theme: selectedTheme?.theme,
75+
theme: {
76+
...selectedTheme?.theme,
77+
...(options.margin ? { margin: options.margin } : {}),
78+
},
7679
}
7780
81+
console.log('Export options:', exportOptions)
82+
7883
try {
7984
const buffer = await markdownDocx(markdownContent.value, exportOptions)
8085
const blob = await Packer.toBlob(buffer)

web/src/components/ExportModal.vue

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,17 @@
8080
></textarea>
8181
</div>
8282

83+
<div class="mb-4">
84+
<label for="doc-margin" class="block text-sm font-medium text-gray-700 text-left">{{ t('margin') }}</label>
85+
<input
86+
v-model="formData.margin"
87+
type="text"
88+
id="doc-margin"
89+
class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm"
90+
:placeholder="t('margin_placeholder')"
91+
/>
92+
</div>
93+
8394
<div class="mt-4 space-y-2">
8495
<div class="flex items-start">
8596
<div class="flex items-center h-5">
@@ -161,6 +172,7 @@ const formData = reactive({
161172
name: '',
162173
title: '',
163174
description: '',
175+
margin: '',
164176
ignoreImage: false,
165177
ignoreFootnote: false,
166178
ignoreHtml: false

web/src/composables/useI18n.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ const translations = {
8484
theme_modern: {
8585
zh: '现代',
8686
en: 'Modern'
87+
},
88+
margin: {
89+
zh: '页边距',
90+
en: 'Page Margin'
91+
},
92+
margin_placeholder: {
93+
zh: '例如: 2cm 或 2cm 1.5cm',
94+
en: 'e.g. 2cm or 2cm 1.5cm'
8795
}
8896
}
8997

0 commit comments

Comments
 (0)