@@ -24,8 +24,7 @@ export class BratSettingsTab extends PluginSettingTab {
24
24
'If enabled beta plugins will be automatically enabled after installtion by default. Note: you can toggle this on and off for each plugin in the "Add Plugin" form.' ,
25
25
)
26
26
. addToggle ( ( cb : ToggleComponent ) => {
27
- cb . setValue ( this . plugin . settings . enableAfterInstall ) ;
28
- cb . onChange ( async ( value : boolean ) => {
27
+ cb . setValue ( this . plugin . settings . enableAfterInstall ) . onChange ( async ( value : boolean ) => {
29
28
this . plugin . settings . enableAfterInstall = value ;
30
29
await this . plugin . saveSettings ( ) ;
31
30
} ) ;
@@ -37,8 +36,7 @@ export class BratSettingsTab extends PluginSettingTab {
37
36
"If enabled all beta plugins will be checked for updates each time Obsidian starts. Note: this does not update frozen version plugins." ,
38
37
)
39
38
. addToggle ( ( cb : ToggleComponent ) => {
40
- cb . setValue ( this . plugin . settings . updateAtStartup ) ;
41
- cb . onChange ( async ( value : boolean ) => {
39
+ cb . setValue ( this . plugin . settings . updateAtStartup ) . onChange ( async ( value : boolean ) => {
42
40
this . plugin . settings . updateAtStartup = value ;
43
41
await this . plugin . saveSettings ( ) ;
44
42
} ) ;
@@ -48,8 +46,7 @@ export class BratSettingsTab extends PluginSettingTab {
48
46
. setName ( "Auto-update themes at startup" )
49
47
. setDesc ( "If enabled all beta themes will be checked for updates each time Obsidian starts." )
50
48
. addToggle ( ( cb : ToggleComponent ) => {
51
- cb . setValue ( this . plugin . settings . updateThemesAtStartup ) ;
52
- cb . onChange ( async ( value : boolean ) => {
49
+ cb . setValue ( this . plugin . settings . updateThemesAtStartup ) . onChange ( async ( value : boolean ) => {
53
50
this . plugin . settings . updateThemesAtStartup = value ;
54
51
await this . plugin . saveSettings ( ) ;
55
52
} ) ;
@@ -72,8 +69,7 @@ export class BratSettingsTab extends PluginSettingTab {
72
69
} ) ;
73
70
74
71
new Setting ( containerEl ) . addButton ( ( cb : ButtonComponent ) => {
75
- cb . setButtonText ( "Add beta plugin" ) ;
76
- cb . onClick ( ( ) => {
72
+ cb . setButtonText ( "Add beta plugin" ) . onClick ( ( ) => {
77
73
this . plugin . betaPlugins . displayAddNewPluginModal ( true , true ) ;
78
74
} ) ;
79
75
} ) ;
@@ -93,66 +89,68 @@ export class BratSettingsTab extends PluginSettingTab {
93
89
btn
94
90
. setIcon ( "sync" )
95
91
. setTooltip ( "Check and update plugin" )
96
- . setClass ( "mod-cta" )
97
92
. onClick ( async ( ) => {
98
- const updated = await this . plugin . betaPlugins . updatePlugin ( p , false , true , false , bp ?. token ) ;
93
+ await this . plugin . betaPlugins . updatePlugin ( p , false , true , false , bp ?. token ) ;
99
94
} ) ;
100
95
} ) ;
101
96
}
102
97
103
98
// Container for the edit and removal buttons
104
99
pluginSettingContainer
105
100
. addButton ( ( btn : ButtonComponent ) => {
106
- btn . setIcon ( "edit" ) ;
107
- btn . setTooltip ( "Change version" ) ;
108
- btn . onClick ( ( ) => {
109
- this . plugin . betaPlugins . displayAddNewPluginModal ( true , true , p , bp ?. version , bp ?. token ) ;
110
- this . plugin . app . setting . updatePluginSection ( ) ;
111
- } ) ;
101
+ btn
102
+ . setIcon ( "edit" )
103
+ . setTooltip ( "Change version" )
104
+ . onClick ( ( ) => {
105
+ this . plugin . betaPlugins . displayAddNewPluginModal ( true , true , p , bp ?. version , bp ?. token ) ;
106
+ this . plugin . app . setting . updatePluginSection ( ) ;
107
+ } ) ;
112
108
} )
113
109
. addButton ( ( btn : ButtonComponent ) => {
114
- btn . setIcon ( "cross" ) ;
115
- btn . setTooltip ( "Remove this beta plugin" ) ;
116
- btn . setWarning ( ) ;
117
- btn . onClick ( ( ) => {
118
- if ( btn . buttonEl . textContent === "" ) btn . setButtonText ( "Click once more to confirm removal" ) ;
119
- else {
120
- const { buttonEl } = btn ;
121
- const { parentElement } = buttonEl ;
122
- if ( parentElement ?. parentElement ) {
123
- parentElement . parentElement . remove ( ) ;
124
- this . plugin . betaPlugins . deletePlugin ( p ) ;
110
+ btn
111
+ . setIcon ( "cross" )
112
+ . setTooltip ( "Remove this beta plugin" )
113
+ . setWarning ( )
114
+ . onClick ( ( ) => {
115
+ if ( btn . buttonEl . textContent === "" ) {
116
+ btn . setButtonText ( "Click once more to confirm removal" ) ;
117
+ } else {
118
+ const { buttonEl } = btn ;
119
+ const { parentElement } = buttonEl ;
120
+ if ( parentElement ?. parentElement ) {
121
+ parentElement . parentElement . remove ( ) ;
122
+ this . plugin . betaPlugins . deletePlugin ( p ) ;
123
+ }
125
124
}
126
- }
127
- } ) ;
125
+ } ) ;
128
126
} ) ;
129
127
}
130
128
131
129
new Setting ( containerEl ) . setName ( "Beta themes list" ) . setHeading ( ) ;
132
130
133
131
new Setting ( containerEl ) . addButton ( ( cb : ButtonComponent ) => {
134
- cb . setButtonText ( "Add beta theme" ) ;
135
- cb . onClick ( ( ) => {
132
+ cb . setButtonText ( "Add beta theme" ) . onClick ( ( ) => {
136
133
this . plugin . app . setting . close ( ) ;
137
134
new AddNewTheme ( this . plugin ) . open ( ) ;
138
135
} ) ;
139
136
} ) ;
140
137
141
138
for ( const bp of this . plugin . settings . themesList ) {
142
139
new Setting ( containerEl ) . setName ( createLink ( bp . repo ) ) . addButton ( ( btn : ButtonComponent ) => {
143
- btn . setIcon ( "cross" ) ;
144
- btn . setTooltip ( "Delete this beta theme" ) ;
145
- btn . onClick ( ( ) => {
146
- if ( btn . buttonEl . textContent === "" ) btn . setButtonText ( "Click once more to confirm removal" ) ;
147
- else {
148
- const { buttonEl } = btn ;
149
- const { parentElement } = buttonEl ;
150
- if ( parentElement ?. parentElement ) {
151
- parentElement . parentElement . remove ( ) ;
152
- themeDelete ( this . plugin , bp . repo ) ;
140
+ btn
141
+ . setIcon ( "cross" )
142
+ . setTooltip ( "Delete this beta theme" )
143
+ . onClick ( ( ) => {
144
+ if ( btn . buttonEl . textContent === "" ) btn . setButtonText ( "Click once more to confirm removal" ) ;
145
+ else {
146
+ const { buttonEl } = btn ;
147
+ const { parentElement } = buttonEl ;
148
+ if ( parentElement ?. parentElement ) {
149
+ parentElement . parentElement . remove ( ) ;
150
+ themeDelete ( this . plugin , bp . repo ) ;
151
+ }
153
152
}
154
- }
155
- } ) ;
153
+ } ) ;
156
154
} ) ;
157
155
}
158
156
@@ -173,8 +171,7 @@ export class BratSettingsTab extends PluginSettingTab {
173
171
. setName ( "Enable logging" )
174
172
. setDesc ( "Plugin updates will be logged to a file in the log file." )
175
173
. addToggle ( ( cb : ToggleComponent ) => {
176
- cb . setValue ( this . plugin . settings . loggingEnabled ) ;
177
- cb . onChange ( async ( value : boolean ) => {
174
+ cb . setValue ( this . plugin . settings . loggingEnabled ) . onChange ( async ( value : boolean ) => {
178
175
this . plugin . settings . loggingEnabled = value ;
179
176
await this . plugin . saveSettings ( ) ;
180
177
} ) ;
@@ -196,8 +193,7 @@ export class BratSettingsTab extends PluginSettingTab {
196
193
. setName ( "Enable verbose logging" )
197
194
. setDesc ( "Get a lot more information in the log." )
198
195
. addToggle ( ( cb : ToggleComponent ) => {
199
- cb . setValue ( this . plugin . settings . loggingVerboseEnabled ) ;
200
- cb . onChange ( async ( value : boolean ) => {
196
+ cb . setValue ( this . plugin . settings . loggingVerboseEnabled ) . onChange ( async ( value : boolean ) => {
201
197
this . plugin . settings . loggingVerboseEnabled = value ;
202
198
await this . plugin . saveSettings ( ) ;
203
199
} ) ;
@@ -207,8 +203,7 @@ export class BratSettingsTab extends PluginSettingTab {
207
203
. setName ( "Debugging mode" )
208
204
. setDesc ( "Atomic Bomb level console logging. Can be used for troubleshoting and development." )
209
205
. addToggle ( ( cb : ToggleComponent ) => {
210
- cb . setValue ( this . plugin . settings . debuggingMode ) ;
211
- cb . onChange ( async ( value : boolean ) => {
206
+ cb . setValue ( this . plugin . settings . debuggingMode ) . onChange ( async ( value : boolean ) => {
212
207
this . plugin . settings . debuggingMode = value ;
213
208
await this . plugin . saveSettings ( ) ;
214
209
} ) ;
0 commit comments