mirror of
				https://github.com/zulip/zulip-desktop.git
				synced 2025-10-31 03:53:34 +00:00 
			
		
		
		
	Toggle spell checker in the session rather than the webPreferences.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
		| @@ -71,13 +71,7 @@ export default class WebView { | ||||
|           ? html`` | ||||
|           : html`preload="${props.preload}"`} | ||||
|         partition="persist:webviewsession" | ||||
|         webpreferences=" | ||||
|           contextIsolation, | ||||
|           spellcheck=${Boolean( | ||||
|           ConfigUtil.getConfigItem("enableSpellchecker", true), | ||||
|         )}, | ||||
|           worldSafeExecuteJavaScript=true | ||||
|         " | ||||
|         webpreferences="contextIsolation, worldSafeExecuteJavaScript=true" | ||||
|       > | ||||
|       </webview> | ||||
|     `; | ||||
|   | ||||
| @@ -128,7 +128,6 @@ export class ServerManagerView { | ||||
|     await this.initTabs(); | ||||
|     this.initActions(); | ||||
|     this.registerIpcs(); | ||||
|     ipcRenderer.send("set-spellcheck-langs"); | ||||
|   } | ||||
|  | ||||
|   async loadProxy(): Promise<void> { | ||||
|   | ||||
| @@ -425,6 +425,7 @@ export function initGeneralSection({$root}: GeneralSectionProps): void { | ||||
|       clickHandler: () => { | ||||
|         const newValue = !ConfigUtil.getConfigItem("enableSpellchecker", true); | ||||
|         ConfigUtil.setConfigItem("enableSpellchecker", newValue); | ||||
|         ipcRenderer.send("configure-spell-checker"); | ||||
|         enableSpellchecker(); | ||||
|         const spellcheckerLanguageInput: HTMLElement = | ||||
|           $root.querySelector("#spellcheck-langs")!; | ||||
| @@ -664,7 +665,7 @@ export function initGeneralSection({$root}: GeneralSectionProps): void { | ||||
|       tagField.addEventListener("change", () => { | ||||
|         if (tagField.value.length === 0) { | ||||
|           ConfigUtil.setConfigItem("spellcheckerLanguages", []); | ||||
|           ipcRenderer.send("set-spellcheck-langs"); | ||||
|           ipcRenderer.send("configure-spell-checker"); | ||||
|         } else { | ||||
|           const data: unknown = JSON.parse(tagField.value); | ||||
|           const spellLangs: string[] = z | ||||
| @@ -672,7 +673,7 @@ export function initGeneralSection({$root}: GeneralSectionProps): void { | ||||
|             .parse(data) | ||||
|             .map((elt) => languagePairs.get(elt.value)!); | ||||
|           ConfigUtil.setConfigItem("spellcheckerLanguages", spellLangs); | ||||
|           ipcRenderer.send("set-spellcheck-langs"); | ||||
|           ipcRenderer.send("configure-spell-checker"); | ||||
|         } | ||||
|       }); | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user