@@ -65,34 +65,35 @@ export class JsEnginePluginSettingTab extends PluginSettingTab {
6565 }
6666 if ( startupScripts . length == 0 ) {
6767 new Setting ( containerEl ) . setName ( 'No JS snippets found' ) . setDesc ( `JS snippets are stored in "vault/${ settings . startupScriptsDirectory ?? '' } "` ) ;
68- }
69- for ( const file of startupScripts ) {
70- new Setting ( containerEl )
71- . setName ( file . basename )
72- . setDesc ( `Apply JS snippet from "vault/${ file . path } "` )
73- . addToggle ( el => {
74- el . setValue ( settings . startupScripts . contains ( file . path ) ) . onChange ( async val => this . toggleStartupScript ( file , val ) ) ;
75- } ) ;
68+ } else {
69+ for ( const file of startupScripts ) {
70+ new Setting ( containerEl )
71+ . setName ( file . basename )
72+ . setDesc ( `Apply JS snippet from "vault/${ file . path } "` )
73+ . addToggle ( el => {
74+ el . setValue ( settings . startupScripts . contains ( file . path ) ) . onChange ( async val => this . toggleStartupScript ( file , val ) ) ;
75+ } ) ;
76+ }
7677 }
7778
7879 const oldScripts = settings . startupScripts
7980 . map ( file => vault . getFileByPath ( file ) ! )
8081 . filter ( file => ! file . parent ?. path . startsWith ( settings . startupScriptsDirectory ?? '' ) ) ;
8182 if ( oldScripts . length > 0 ) {
8283 this . containerEl . createEl ( 'div' , { cls : 'callout js-engine-settings-warning' , text : 'These scripts are not in the Snippets Folder' } ) ;
83- }
84- for ( const file of oldScripts ) {
85- new Setting ( containerEl )
86- . setName ( file . basename )
87- . setDesc ( `Apply JS snippet from "vault/ ${ file . path } "` )
88- . addExtraButton ( el => {
89- el . setTooltip ( 'Move to current Snippets Folder ')
90- . setIcon ( 'archive-restore' )
91- . onClick ( async ( ) => await this . moveStartupScriptToNewDirectory ( file ) ) ;
92- } )
93- . addToggle ( el => {
94- el . setValue ( settings . startupScripts . contains ( file . path ) ) . onChange ( async val => this . toggleStartupScript ( file , val ) ) ;
95- } ) ;
84+ for ( const file of oldScripts ) {
85+ new Setting ( containerEl )
86+ . setName ( file . basename )
87+ . setDesc ( `Apply JS snippet from "vault/ ${ file . path } "` )
88+ . addExtraButton ( el => {
89+ el . setTooltip ( 'Move to current Snippets Folder' )
90+ . setIcon ( 'archive-restore ')
91+ . onClick ( async ( ) => await this . moveStartupScriptToNewDirectory ( file ) ) ;
92+ } )
93+ . addToggle ( el => {
94+ el . setValue ( settings . startupScripts . contains ( file . path ) ) . onChange ( async val => this . toggleStartupScript ( file , val ) ) ;
95+ } ) ;
96+ }
9697 }
9798 }
9899
0 commit comments