diff --git a/sandbox/App.vue b/sandbox/App.vue index 13d096ce..c71254ac 100644 --- a/sandbox/App.vue +++ b/sandbox/App.vue @@ -1,40 +1,32 @@ @@ -49,9 +41,10 @@ const contentUpdated = (markdown: string) => { console.log('content updated') } -const modeChanged = (mode: string) => { - console.log('mode', mode) - if (mode === 'edit' || mode === 'split') { +const mode = ref('read') +const modeChanged = (m: string) => { + mode.value = m + if (mode.value === 'edit' || mode.value === 'split') { originalContent.value = content.value console.log('begin editing') } @@ -89,10 +82,43 @@ onBeforeMount(async () => { diff --git a/src/components/MarkdownUi.vue b/src/components/MarkdownUi.vue index 33defa22..eb443abc 100644 --- a/src/components/MarkdownUi.vue +++ b/src/components/MarkdownUi.vue @@ -348,7 +348,7 @@ const download = (): void => { const data = URL.createObjectURL(blob) const link = document.createElement('a') link.href = data - link.download = `${props.filename.replace(/(\.md)+$/g, '')}.md` + link.download = `${props.filename.replace(/ /g, '-').replace(/[^-+.a-zA-Z0-9_]/g, '').replace(/(\.md)+$/g, '')}.md` // link.click() doesn't work in Firefox link.dispatchEvent(