Skip to content

Commit

Permalink
feat: custom filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
sywhb committed Mar 7, 2023
1 parent d27c8e5 commit 650a9ad
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ interface Settings {
endpoint: string;
dateHighlightedFormat: string;
dateSavedFormat: string;
filename: string;
}
const DEFAULT_SETTINGS: Settings = {
dateHighlightedFormat: "yyyy-MM-dd HH:mm:ss",
Expand Down Expand Up @@ -80,6 +81,7 @@ const DEFAULT_SETTINGS: Settings = {
folder: "Omnivore/{{date}}",
folderDateFormat: "yyyy-MM-dd",
endpoint: "https://api-prod.omnivore.app/api/graphql",
filename: "{{{title}}}",
};

export default class OmnivorePlugin extends Plugin {
Expand Down Expand Up @@ -532,15 +534,20 @@ class OmnivoreSettingTab extends PluginSettingTab {
});
});

containerEl.createEl("h3", {
cls: "collapsible",
text: "Advanced Settings",
});

const advancedSettings = containerEl.createEl("div", {
cls: "content",
});

new Setting(generalSettings)
.setName("Filename")
.setDesc(
"Enter the filename where the data will be stored. {{{title}}} and {{date}} could be used in the filename"
)
.addText((text) =>
text
.setPlaceholder("Enter the filename")
.setValue(this.plugin.settings.filename)
.onChange(async (value) => {
this.plugin.settings.filename = value;
await this.plugin.saveSettings();
})
);
new Setting(generalSettings)
.setName("Folder Date Format")
.setDesc(
Expand Down Expand Up @@ -584,6 +591,15 @@ class OmnivoreSettingTab extends PluginSettingTab {
})
);

containerEl.createEl("h3", {
cls: "collapsible",
text: "Advanced Settings",
});

const advancedSettings = containerEl.createEl("div", {
cls: "content",
});

new Setting(advancedSettings)
.setName("API Endpoint")
.setDesc("Enter the Omnivore server's API endpoint")
Expand Down

0 comments on commit 650a9ad

Please sign in to comment.