diff --git a/src/code-store.js b/src/code-store.js index c6e6ec1f47..5467901d4a 100644 --- a/src/code-store.js +++ b/src/code-store.js @@ -35,5 +35,5 @@ export const fromUrl = data => { }; export const updateCodeStore = newState => { codeStore.set(newState); - push('/edit/' + Base64.encode(JSON.stringify(newState))) -}; \ No newline at end of file + push('/edit/' + Base64.encodeURI(JSON.stringify(newState))) +}; diff --git a/src/components/Config.svelte b/src/components/Config.svelte index 57572d5b4b..dc36da2f1e 100644 --- a/src/components/Config.svelte +++ b/src/components/Config.svelte @@ -38,7 +38,7 @@ const handleConfUpdate = conf => { console.log('Error in parsed', e); configErrorStore.set(e); const str = JSON.stringify({ code, mermaid: oldConf }); - push('/edit/' + Base64.encode(str)) + push('/edit/' + Base64.encodeURI(str)) } }; diff --git a/src/components/Editor.svelte b/src/components/Editor.svelte index 56af40bb16..ec1b453031 100644 --- a/src/components/Editor.svelte +++ b/src/components/Editor.svelte @@ -36,7 +36,7 @@ const handleCodeUpdate = code => { codeErrorStore.set(e); console.log('Error in parsed', e.hash); const str = JSON.stringify({ code: code, mermaid: conf }); - push('/edit/' + Base64.encode(str)) + push('/edit/' + Base64.encodeURI(str)) const l = e.hash.line; decArr.push(edit.deltaDecorations([], [ { range: new monaco.Range(e.hash.loc.first_line,e.hash.loc.last_line,e.hash.loc.first_column,e.hash.loc.last_column), options: { inlineClassName: 'myInlineDecoration' }}] diff --git a/src/components/Links.svelte b/src/components/Links.svelte index e5941967fd..9abc4bc8cc 100644 --- a/src/components/Links.svelte +++ b/src/components/Links.svelte @@ -58,9 +58,9 @@ let url = '/mermaid-live-editor/#/view'; let iUrl; let mdCode; const unsubscribe = codeStore.subscribe( state => { - url = '/mermaid-live-editor/#/view/' + Base64.encode(JSON.stringify(state)); - iUrl = `https://mermaid.ink/img/${Base64.encode(JSON.stringify(state))}`; - mdCode = `[![](${iUrl})](${window.location.protocol}//${window.location.host}${window.location.pathname}#/edit/${Base64.encode(JSON.stringify(state))})`; +url = '/mermaid-live-editor/#/view/' + Base64.encodeURI(JSON.stringify(state)); +iUrl = `https://mermaid.ink/img/${Base64.encodeURI(JSON.stringify(state))}`; + mdCode = `[![](${iUrl})](${window.location.protocol}//${window.location.host}${window.location.pathname}#/edit/${Base64.encodeURI(JSON.stringify(state))})`; }); @@ -90,8 +90,7 @@ label[for="markdown"] { Download PNG -

-

\ No newline at end of file +