@@ -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