File tree 2 files changed +15
-1
lines changed
2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ export interface BookSearchPluginSettings {
33
33
showCoverImageInSearch : boolean ;
34
34
enableCoverImageSave : boolean ;
35
35
coverImagePath : string ;
36
+ askForLocale : boolean ;
36
37
}
37
38
38
39
export const DEFAULT_SETTINGS : BookSearchPluginSettings = {
@@ -52,6 +53,7 @@ export const DEFAULT_SETTINGS: BookSearchPluginSettings = {
52
53
showCoverImageInSearch : false ,
53
54
enableCoverImageSave : false ,
54
55
coverImagePath : '' ,
56
+ askForLocale : true ,
55
57
} ;
56
58
57
59
export class BookSearchSettingTab extends PluginSettingTab {
@@ -284,6 +286,17 @@ export class BookSearchSettingTab extends PluginSettingTab {
284
286
} ) ,
285
287
) ;
286
288
289
+ // A toggle whether or not to ask for the locale every time a search is made
290
+ new Setting ( containerEl )
291
+ . setName ( 'Ask for Locale' )
292
+ . setDesc ( 'Toggle to enable or disable asking for the locale every time a search is made.' )
293
+ . addToggle ( toggle =>
294
+ toggle . setValue ( this . plugin . settings . askForLocale ) . onChange ( async value => {
295
+ this . plugin . settings . askForLocale = value ;
296
+ await this . plugin . saveSettings ( ) ;
297
+ } ) ,
298
+ ) ;
299
+
287
300
new Setting ( containerEl )
288
301
. setName ( 'Enable Cover Image Save' )
289
302
. setDesc ( 'Toggle to enable or disable saving cover images in notes.' )
Original file line number Diff line number Diff line change @@ -49,7 +49,8 @@ export class BookSearchModal extends Modal {
49
49
onOpen ( ) : void {
50
50
const { contentEl } = this ;
51
51
contentEl . createEl ( 'h2' , { text : 'Search Book' } ) ;
52
- if ( this . plugin . settings . serviceProvider === ServiceProvider . google ) this . renderSelectLocale ( ) ;
52
+ if ( this . plugin . settings . serviceProvider === ServiceProvider . google && this . plugin . settings . askForLocale )
53
+ this . renderSelectLocale ( ) ;
53
54
contentEl . createDiv ( { cls : 'book-search-plugin__search-modal--input' } , el => {
54
55
new TextComponent ( el )
55
56
. setValue ( this . query )
You can’t perform that action at this time.
0 commit comments