This commit is contained in:
Sidharth Vinod
2021-05-04 17:29:38 +05:30
parent 068de0c067
commit a22e499576
6 changed files with 26 additions and 14 deletions
+2 -2
View File
@@ -8,7 +8,7 @@
<link rel="icon" type="image/png" href="favicon.png" />
<link rel="stylesheet" href="styles.css" />
<link rel="stylesheet" href="dist/bundle.css" />
<link rel="stylesheet" href="bundle.css" />
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.2/css/all.min.css"
@@ -55,6 +55,6 @@
/>
</head>
<body>
<script src="dist/bundle.js"></script>
<script src="bundle.js"></script>
</body>
</html>
+1 -1
View File
@@ -48,4 +48,4 @@
"yarn": "1.22.10",
"npm": "7.11.2"
}
}
}
+8 -6
View File
@@ -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))
);
});
};
+9 -4
View File
@@ -1,6 +1,11 @@
<script>
import { onMount } from 'svelte';
import { codeStore, updateCode, updateCodeStore } from '../code-store.js';
import {
codeStore,
updateCode,
updateCodeStore,
initURLSubscription,
} from '../code-store.js';
import Editor from '../components/Editor.svelte';
import Config from '../components/Config.svelte';
import View from '../components/View.svelte';
@@ -11,6 +16,8 @@
import pkg from '@mermaid/package.json';
import moment from 'moment';
export let mermaidVersion = pkg.version;
export let params = {};
let historyList = [];
onMount(async () => {
ga('send', 'pageview');
@@ -20,7 +27,6 @@
historyList = JSON.parse(localStorage.getItem(historyListKey) || '[]');
let hisCode =
historyList.length > 0 ? historyList[historyList.length - 1] : null;
if (params.data) {
fromUrl(params.data);
} else if (hisCode) {
@@ -32,7 +38,7 @@
} else {
loadSampleDiagram('Flow Chart');
}
initURLSubscription();
let code = null;
codeStore.subscribe((state) => {
code = (state && state.code) || code;
@@ -54,7 +60,6 @@
}, 1 * 60 * 1000);
});
export let params = {};
const samples = {
'Flow Chart': `graph TD
A[Christmas] -->|Get money| B(Go shopping)
+5
View File
@@ -1,9 +1,14 @@
<script>
import { onMount } from 'svelte';
import View from '../components/View.svelte';
import { fromUrl } from '../code-store.js';
export let params = {};
onMount(async () => {
ga('send', 'pageview');
if (params.data) {
fromUrl(params.data);
}
});
</script>
+1 -1
View File
@@ -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',
},