Skip to content

Commit c60f4d6

Browse files
authored
Merge pull request #4 from willjasen/dev
Dev
2 parents bef0fdc + 982cafc commit c60f4d6

File tree

3 files changed

+31
-33
lines changed

3 files changed

+31
-33
lines changed

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
# This script builds the plugin and copies the output files into the associated plugin directory
4-
# After the script is run, this plugin in Obisidian should disabled/enabled to refresh it
4+
# After this build script is run, this plugin in Obisidian should disabled/enabled to refresh it
55

66
# variables
77
SOURCE_DIR="/Users/willjasen/GitHub/obsidian-binary-file-manager-plugin";

manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"id": "obsidian-binary-file-manager-plugin",
33
"name": "Binary File Manager",
4-
"version": "0.4.2",
4+
"version": "0.4.3",
55
"minAppVersion": "0.12.0",
6-
"description": "Detects new binary files in the vault and create markdown files with metadata.",
6+
"description": "Detects new binary files in the vault and creates markdown files with metadata.",
77
"author": "qawatake, matthewturk, willjasen",
88
"authorUrl": "https://github.com/willjasen/obsidian-binary-file-manager-plugin",
99
"isDesktopOnly": false

src/Setting.ts

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -122,40 +122,38 @@ export class BinaryFileManagerSettingTab extends PluginSettingTab {
122122
});
123123
});
124124

125-
this.plugin.settings.tags.forEach((tag) => {
126-
new Setting(containerEl).setName(tag).addExtraButton((cb) => {
127-
cb.setIcon('cross').onClick(async () => {
128-
let index = this.plugin.settings.tags.indexOf(tag);
129-
let removedElementsArray = this.plugin.settings.tags.splice(index, 1);
130-
await this.plugin.saveSettings();
131-
this.display();
125+
// Create the "Use Templater" toggle setting
126+
new Setting(containerEl)
127+
.setName('Use Templater')
128+
.addToggle(async (component) => {
129+
component
130+
.setValue(this.plugin.settings.useTemplater)
131+
.onChange((value) => {
132+
this.plugin.settings.useTemplater = value;
133+
this.plugin.saveSettings();
134+
135+
// Show or hide the Template file location setting based on the toggle value
136+
templateSetting.settingEl.style.display = value ? 'block' : 'none';
132137
});
133-
});
134138
});
135139

136-
new Setting(containerEl)
137-
.setName('Template file location')
138-
.addSearch((component) => {
139-
new FileSuggest(this.app, component.inputEl);
140-
component
141-
.setPlaceholder('Example: folder1/note')
142-
.setValue(this.plugin.settings.templatePath)
143-
.onChange((newTemplateFile) => {
144-
this.plugin.settings.templatePath = newTemplateFile;
145-
this.plugin.saveSettings();
146-
});
147-
});
140+
// Create the "Template file location" search setting and initially hide or show it
141+
const templateSetting = new Setting(containerEl)
142+
.setName('Template file location')
143+
.addSearch((component) => {
144+
new FileSuggest(this.app, component.inputEl);
145+
component
146+
.setPlaceholder('Example: folder1/note')
147+
.setValue(this.plugin.settings.templatePath)
148+
.onChange((newTemplateFile) => {
149+
this.plugin.settings.templatePath = newTemplateFile;
150+
this.plugin.saveSettings();
151+
});
152+
});
153+
154+
// Set the initial visibility of the "Template file location" setting
155+
templateSetting.settingEl.style.display = this.plugin.settings.useTemplater ? 'block' : 'none';
148156

149-
new Setting(containerEl)
150-
.setName('Use Templater')
151-
.addToggle(async (component) => {
152-
component
153-
.setValue(this.plugin.settings.useTemplater)
154-
.onChange((value) => {
155-
this.plugin.settings.useTemplater = value;
156-
this.plugin.saveSettings();
157-
});
158-
});
159157

160158
let extensionToBeAdded: string;
161159
new Setting(containerEl)

0 commit comments

Comments
 (0)