mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-26 17:41:34 +08:00 
			
		
		
		
	feat(options): restart when setting locale
This commit is contained in:
		
							parent
							
								
									a5a7a30cd5
								
							
						
					
					
						commit
						ab58671625
					
				| @ -10,6 +10,17 @@ function reloadFrontendApp(reason?: string) { | |||||||
|     window.location.reload(); |     window.location.reload(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | function restartDesktopApp() { | ||||||
|  |     if (!isElectron()) { | ||||||
|  |         reloadFrontendApp(); | ||||||
|  |         return; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     const app = dynamicRequire("@electron/remote").app; | ||||||
|  |     app.relaunch(); | ||||||
|  |     app.exit(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| /** | /** | ||||||
|  * Triggers the system tray to update its menu items, i.e. after a change in dynamic content such as bookmarks or recent notes. |  * Triggers the system tray to update its menu items, i.e. after a change in dynamic content such as bookmarks or recent notes. | ||||||
|  * |  * | ||||||
| @ -739,6 +750,7 @@ function isLaunchBarConfig(noteId: string) { | |||||||
| 
 | 
 | ||||||
| export default { | export default { | ||||||
|     reloadFrontendApp, |     reloadFrontendApp, | ||||||
|  |     restartDesktopApp, | ||||||
|     reloadTray, |     reloadTray, | ||||||
|     parseDate, |     parseDate, | ||||||
|     getMonthsInDateRange, |     getMonthsInDateRange, | ||||||
|  | |||||||
| @ -61,11 +61,7 @@ export default class ElectronIntegrationOptions extends OptionsWidget { | |||||||
|         this.$backgroundEffects.on("change", () => this.updateCheckboxOption("backgroundEffects", this.$backgroundEffects)); |         this.$backgroundEffects.on("change", () => this.updateCheckboxOption("backgroundEffects", this.$backgroundEffects)); | ||||||
| 
 | 
 | ||||||
|         const restartAppButton = this.$widget.find(".restart-app-button"); |         const restartAppButton = this.$widget.find(".restart-app-button"); | ||||||
|         restartAppButton.on("click", () => { |         restartAppButton.on("click", utils.restartDesktopApp); | ||||||
|             const app = utils.dynamicRequire("@electron/remote").app; |  | ||||||
|             app.relaunch(); |  | ||||||
|             app.exit(); |  | ||||||
|         }); |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     isEnabled() { |     isEnabled() { | ||||||
|  | |||||||
| @ -59,6 +59,7 @@ export default class LocalizationOptions extends OptionsWidget { | |||||||
|         this.$formattingLocaleSelect.on("change", async () => { |         this.$formattingLocaleSelect.on("change", async () => { | ||||||
|             const newLocale = this.$formattingLocaleSelect.val(); |             const newLocale = this.$formattingLocaleSelect.val(); | ||||||
|             await server.put(`options/formattingLocale/${newLocale}`); |             await server.put(`options/formattingLocale/${newLocale}`); | ||||||
|  |             utils.restartDesktopApp(); | ||||||
|         }); |         }); | ||||||
| 
 | 
 | ||||||
|         this.$widget.find(`input[name="first-day-of-week"]`).on("change", () => { |         this.$widget.find(`input[name="first-day-of-week"]`).on("change", () => { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Elian Doran
						Elian Doran