Improves export config modal and template vars
Refactors the export configuration modal to provide a better user experience and more accurate default values. - Removes the batch export feature from the right-click menu. - Updates the template variables to derive from the settings tab. - Modifies the reset function in the export config modal to reset to plugin defaults. - Improves font handling and font size settings in the TypographySection of the export config modal, including slider for font size. - Enhances default template variable initialization in the ModalState.
This commit is contained in:
5 files changed
+141
-127
No files matched your search
@@ -288,17 +288,6 @@ export class obsidianTypstPDFExport extends Plugin {
|
||||
})
|
||||
);
|
||||
|
||||
menu.addSeparator();
|
||||
|
||||
menu.addItem((item) =>
|
||||
item
|
||||
.setTitle('Batch export...')
|
||||
.setIcon('folder-output')
|
||||
.onClick(() => {
|
||||
this.batchExportNotes();
|
||||
})
|
||||
);
|
||||
|
||||
menu.showAtMouseEvent(event);
|
||||
}
|
||||
|
||||
@@ -339,21 +328,21 @@ export class obsidianTypstPDFExport extends Plugin {
|
||||
openAfterExport: this.settings.behavior.openAfterExport,
|
||||
preserveFolderStructure: this.settings.behavior.preserveFolderStructure,
|
||||
availableTemplates: availableTemplates,
|
||||
// Template variables from plugin defaults
|
||||
// Template variables from settings tab values
|
||||
templateVariables: {
|
||||
pageSize: this.settings.exportDefaults.pageSize,
|
||||
orientation: this.settings.exportDefaults.orientation,
|
||||
flipped: this.settings.exportDefaults.orientation === 'landscape',
|
||||
marginTop: this.settings.exportDefaults.marginTop,
|
||||
marginBottom: this.settings.exportDefaults.marginBottom,
|
||||
marginLeft: this.settings.exportDefaults.marginLeft,
|
||||
marginRight: this.settings.exportDefaults.marginRight,
|
||||
bodyFont: this.settings.exportDefaults.bodyFont,
|
||||
headingFont: this.settings.exportDefaults.headingFont,
|
||||
monospaceFont: this.settings.exportDefaults.monospaceFont,
|
||||
bodyFontSize: this.settings.exportDefaults.bodyFontSize,
|
||||
pageSize: this.settings.pageSetup.size,
|
||||
orientation: this.settings.pageSetup.orientation,
|
||||
flipped: this.settings.pageSetup.orientation === 'landscape',
|
||||
marginTop: this.settings.pageSetup.margins.top.toString(),
|
||||
marginBottom: this.settings.pageSetup.margins.bottom.toString(),
|
||||
marginLeft: this.settings.pageSetup.margins.left.toString(),
|
||||
marginRight: this.settings.pageSetup.margins.right.toString(),
|
||||
bodyFont: this.settings.typography.fonts.body,
|
||||
headingFont: this.settings.typography.fonts.heading,
|
||||
monospaceFont: this.settings.typography.fonts.monospace,
|
||||
bodyFontSize: this.settings.typography.fontSizes.body,
|
||||
// Auto-adjust width for single-page landscape mode
|
||||
...(this.settings.exportDefaults.orientation === 'landscape' && this.settings.exportDefaults.format === 'single-page'
|
||||
...(this.settings.pageSetup.orientation === 'landscape' && this.settings.exportDefaults.format === 'single-page'
|
||||
? { width: 'auto' }
|
||||
: {})
|
||||
}
|
||||
@@ -551,15 +540,6 @@ export class obsidianTypstPDFExport extends Plugin {
|
||||
new Notice('Export cancelled');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch export multiple notes
|
||||
*/
|
||||
private async batchExportNotes(): Promise<void> {
|
||||
// This would show a modal to select multiple files
|
||||
// Implementation deferred for now
|
||||
new Notice('Batch export feature coming soon');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user