From a22e49957615ea0183ea37b99b144de0b6a3df43 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Tue, 4 May 2021 17:29:38 +0530 Subject: [PATCH] Fix #152 --- docs/index.html | 4 ++-- package.json | 2 +- src/code-store.js | 14 ++++++++------ src/routes/Edit.svelte | 13 +++++++++---- src/routes/View.svelte | 5 +++++ webpack.config.js | 2 +- 6 files changed, 26 insertions(+), 14 deletions(-) diff --git a/docs/index.html b/docs/index.html index bd6784d4..b77ea5b3 100644 --- a/docs/index.html +++ b/docs/index.html @@ -8,7 +8,7 @@ - + - + diff --git a/package.json b/package.json index 89d5d24b..8df303ac 100644 --- a/package.json +++ b/package.json @@ -48,4 +48,4 @@ "yarn": "1.22.10", "npm": "7.11.2" } -} +} \ No newline at end of file diff --git a/src/code-store.js b/src/code-store.js index 90525bc3..d2bce33b 100644 --- a/src/code-store.js +++ b/src/code-store.js @@ -39,9 +39,11 @@ export const updateConfig = (config, updateEditor) => { codeStore.set({ ...state, mermaid: config, updateEditor }); }; -const unsubscribe = codeStore.subscribe((state) => { - const currentLocation = get(location).split('/')[1]; - replace( - `/${currentLocation || 'edit'}/` + Base64.encodeURI(JSON.stringify(state)) - ); -}); +export const initURLSubscription = () => { + codeStore.subscribe((state) => { + const currentLocation = get(location).split('/')[1]; + replace( + `/${currentLocation || 'edit'}/` + Base64.encodeURI(JSON.stringify(state)) + ); + }); +}; diff --git a/src/routes/Edit.svelte b/src/routes/Edit.svelte index 5c4cde41..ea578deb 100755 --- a/src/routes/Edit.svelte +++ b/src/routes/Edit.svelte @@ -1,6 +1,11 @@ diff --git a/webpack.config.js b/webpack.config.js index 12f43a98..28e20b8e 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -19,7 +19,7 @@ module.exports = { mainFields: ['svelte', 'browser', 'module', 'main'], }, output: { - path: __dirname + '/docs/dist', + path: path.join(__dirname, '/docs'), filename: '[name].js', chunkFilename: '[name].[id].js', },