diff --git a/src/components/EditForm.svelte b/src/components/EditForm.svelte index cc79ce7..7e44c13 100644 --- a/src/components/EditForm.svelte +++ b/src/components/EditForm.svelte @@ -29,6 +29,17 @@ selectedLanguage = languages.find((e) => e.value === $selectedLang)! }) + selectedLang.subscribe((lang) => { + textWrap = lang === 'plt' || lang === 'md' + }) + + $: { + if (editor) { + // Line wrapping + editor.setOption('lineWrapping', textWrap) + } + } + $: { if (editor) { languages = CodeMirror.modeInfo @@ -49,9 +60,6 @@ editor.setOption('mode', langData.mime) CodeMirror.autoLoadMode(editor, langData.mode) $selectedLang = selectedLanguage?.value ?? 'plt' - - // Line wrapping - editor.setOption('lineWrapping', textWrap) } } diff --git a/src/components/TopBar.svelte b/src/components/TopBar.svelte index c8ce1e6..f154190 100644 --- a/src/components/TopBar.svelte +++ b/src/components/TopBar.svelte @@ -1,11 +1,11 @@