Added download option for image urls
This commit is contained in:
parent
0a65fd8c87
commit
657668dc7d
3 changed files with 56 additions and 0 deletions
|
|
@ -69,6 +69,8 @@ export interface MediaDbPluginSettings {
|
|||
boardgameFolder: string;
|
||||
bookFolder: string;
|
||||
|
||||
imageDownload: boolean;
|
||||
imageFolder: string;
|
||||
propertyMappingModels: PropertyMappingModel[];
|
||||
}
|
||||
|
||||
|
|
@ -130,6 +132,8 @@ const DEFAULT_SETTINGS: MediaDbPluginSettings = {
|
|||
boardgameFolder: 'Media DB/boardgames',
|
||||
bookFolder: 'Media DB/books',
|
||||
|
||||
imageDownload: false,
|
||||
imageFolder: 'Media DB/images',
|
||||
propertyMappingModels: [],
|
||||
};
|
||||
|
||||
|
|
@ -298,6 +302,29 @@ export class MediaDbSettingTab extends PluginSettingTab {
|
|||
});
|
||||
});
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName('Download images')
|
||||
.setDesc('Downloads images for new notes in the folder below')
|
||||
.addToggle(cb => {
|
||||
cb.setValue(this.plugin.settings.imageDownload).onChange(data => {
|
||||
this.plugin.settings.imageDownload = data;
|
||||
void this.plugin.saveSettings();
|
||||
});
|
||||
});
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName('Image folder')
|
||||
.setDesc('Where downloaded images should be stored.')
|
||||
.addSearch(cb => {
|
||||
new FolderSuggest(this.app, cb.inputEl);
|
||||
cb.setPlaceholder(DEFAULT_SETTINGS.imageFolder)
|
||||
.setValue(this.plugin.settings.imageFolder)
|
||||
.onChange(data => {
|
||||
this.plugin.settings.imageFolder = data;
|
||||
void this.plugin.saveSettings();
|
||||
});
|
||||
});
|
||||
|
||||
// Create a map to store APIs for each media type
|
||||
const mediaTypeApiMap = new Map<MediaType, string[]>();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue