Merge branch 'master' into develop

# Conflicts:
#	docs/bundle.css
This commit is contained in:
Ashish Jain
2020-01-15 18:35:35 +01:00
9 changed files with 79 additions and 51 deletions
+9 -8
View File
@@ -1,4 +1,4 @@
#error.svelte-1evofcp{background:darkred;color:white;flex:1;padding:10px}.invisible.svelte-1evofcp{display:none}.visible.svelte-1evofcp{display:block}
#error.svelte-ardmue{background:darkred;color:white;flex:1;padding:10px}.invisible.svelte-ardmue{display:none}.visible.svelte-ardmue{display:block}
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
@@ -2471,10 +2471,11 @@
background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0nMS4wJyBzdGFuZGFsb25lPSdubycgPz4KPHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHZlcnNpb249JzEuMScgd2lkdGg9JzEwcHgnIGhlaWdodD0nMTBweCc+Cgk8c3R5bGU+CiAgICBjaXJjbGUgewogICAgICBhbmltYXRpb246IGJhbGwgMC42cyBsaW5lYXIgaW5maW5pdGU7CiAgICB9CgogICAgY2lyY2xlOm50aC1jaGlsZCgyKSB7IGFuaW1hdGlvbi1kZWxheTogMC4wNzVzOyB9CiAgICBjaXJjbGU6bnRoLWNoaWxkKDMpIHsgYW5pbWF0aW9uLWRlbGF5OiAwLjE1czsgfQogICAgY2lyY2xlOm50aC1jaGlsZCg0KSB7IGFuaW1hdGlvbi1kZWxheTogMC4yMjVzOyB9CiAgICBjaXJjbGU6bnRoLWNoaWxkKDUpIHsgYW5pbWF0aW9uLWRlbGF5OiAwLjNzOyB9CiAgICBjaXJjbGU6bnRoLWNoaWxkKDYpIHsgYW5pbWF0aW9uLWRlbGF5OiAwLjM3NXM7IH0KICAgIGNpcmNsZTpudGgtY2hpbGQoNykgeyBhbmltYXRpb24tZGVsYXk6IDAuNDVzOyB9CiAgICBjaXJjbGU6bnRoLWNoaWxkKDgpIHsgYW5pbWF0aW9uLWRlbGF5OiAwLjUyNXM7IH0KCiAgICBAa2V5ZnJhbWVzIGJhbGwgewogICAgICBmcm9tIHsgb3BhY2l0eTogMTsgfQogICAgICB0byB7IG9wYWNpdHk6IDAuMzsgfQogICAgfQoJPC9zdHlsZT4KCTxnIHN0eWxlPSJmaWxsOndoaXRlOyI+CgkJPGNpcmNsZSBjeD0nNScgY3k9JzEnIHI9JzEnIHN0eWxlPSdvcGFjaXR5OjAuMzsnIC8+CgkJPGNpcmNsZSBjeD0nNy44Mjg0JyBjeT0nMi4xNzE2JyByPScxJyBzdHlsZT0nb3BhY2l0eTowLjM7JyAvPgoJCTxjaXJjbGUgY3g9JzknIGN5PSc1JyByPScxJyBzdHlsZT0nb3BhY2l0eTowLjM7JyAvPgoJCTxjaXJjbGUgY3g9JzcuODI4NCcgY3k9JzcuODI4NCcgcj0nMScgc3R5bGU9J29wYWNpdHk6MC4zOycgLz4KCQk8Y2lyY2xlIGN4PSc1JyBjeT0nOScgcj0nMScgc3R5bGU9J29wYWNpdHk6MC4zOycgLz4KCQk8Y2lyY2xlIGN4PScyLjE3MTYnIGN5PSc3LjgyODQnIHI9JzEnIHN0eWxlPSdvcGFjaXR5OjAuMzsnIC8+CgkJPGNpcmNsZSBjeD0nMScgY3k9JzUnIHI9JzEnIHN0eWxlPSdvcGFjaXR5OjAuMzsnIC8+CgkJPGNpcmNsZSBjeD0nMi4xNzE2JyBjeT0nMi4xNzE2JyByPScxJyBzdHlsZT0nb3BhY2l0eTowLjM7JyAvPgoJPC9nPgo8L3N2Zz4K");
}
#editor.svelte-1lbcct2{width:100%;height:400px;max-height:300px;flex:1}
#editor-conf.svelte-3di0d{width:100%;height:200px;max-height:300px;flex:1}
#view.svelte-8aphr7{border:1px solor darkred;flex:1}.error.svelte-8aphr7{opacity:0.5}
#card.svelte-53tgu4{border:1px solid lightgray;margin-bottom:16px}#title.svelte-53tgu4{border-bottom:1px solid lightgray}#content.svelte-53tgu4{padding-top:16px}.padding.svelte-53tgu4{padding:16px}
#tag.svelte-yy7yhp{height:auto;margin:0 8px 0 0;padding:0 7px;font-size:12px;line-height:20px;white-space:nowrap;border:1px solid #d9d9d9;border-radius:4px;cursor:default;font-size:smaller;color:#52c41a;background:#f6ffed;border-color:#b7eb8f;margin-left:8px}
#editor-root.svelte-13dnmyt{display:flex;height:100%}#col1.svelte-13dnmyt{width:35%}#col2.svelte-13dnmyt{width:65%;padding-left:32px}#app-title.svelte-13dnmyt{border-bottom:1px solid lightgrey;padding-bottom:32px;margin-bottom:32px;font-size:28px;font-weight:400;margin-top:0}#power.svelte-13dnmyt{width:100%;display:flex;justify-content:flex-end;align-items:center}
#view-page.svelte-ecjdrm{display:flex;height:100%}
#editor.svelte-19z36gs{width:100%;height:400px;max-height:300px;flex:1}
#editor-conf.svelte-1hwndan{width:100%;height:200px;max-height:300px;flex:1}
#view.svelte-de7j0c{border:1px solor darkred;flex:1}#container.svelte-de7j0c{overflow-x:auto}.error.svelte-de7j0c{opacity:0.5}
#card.svelte-94c5zs{border:1px solid lightgray;margin-bottom:16px}#title.svelte-94c5zs{border-bottom:1px solid lightgray}#content.svelte-94c5zs{padding-top:16px}.padding.svelte-94c5zs{padding:16px}
#tag.svelte-kzz8td{height:auto;margin:0 8px 0 0;padding:0 7px;font-size:12px;line-height:20px;white-space:nowrap;border:1px solid #d9d9d9;border-radius:4px;cursor:default;font-size:smaller;color:#52c41a;background:#f6ffed;border-color:#b7eb8f;margin-left:8px}
#markdown.svelte-13581ad{padding:7px;font-family:monospace;font-size:14px;width:300px}label[for="markdown"].svelte-13581ad{cursor:pointer;color:-webkit-link;color:-moz-link;color:blue;text-decoration:underline}
#editor-root.svelte-f0aro2{display:flex;height:100%}#col1.svelte-f0aro2{width:35%}#col2.svelte-f0aro2{width:65%;padding-left:32px}#app-title.svelte-f0aro2{border-bottom:1px solid lightgrey;padding-bottom:32px;margin-bottom:32px;font-size:28px;font-weight:400;margin-top:0}#power.svelte-f0aro2{width:100%;display:flex;justify-content:flex-end;align-items:center}
#view-page.svelte-ylwsal{display:flex;height:100%}
+28 -28
View File
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "mermaid-live-editor",
"version": "1.0.0",
"version": "1.1.0",
"license": "MIT",
"devDependencies": {
"cross-env": "^5.2.0",
@@ -19,7 +19,7 @@
"dev": "webpack-dev-server --content-base docs"
},
"dependencies": {
"mermaid": "8.4.4",
"mermaid": "8.4.5",
"js-base64": "^2.5.1",
"json-lint": "^0.1.0",
"jsonlint": "^1.6.3",
+2 -2
View File
@@ -35,5 +35,5 @@ export const fromUrl = data => {
};
export const updateCodeStore = newState => {
codeStore.set(newState);
push('/edit/' + Base64.encode(JSON.stringify(newState)))
};
push('/edit/' + Base64.encodeURI(JSON.stringify(newState)))
};
+1 -1
View File
@@ -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))
}
};
+1 -1
View File
@@ -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' }}]
+28 -4
View File
@@ -49,16 +49,36 @@ export const onDownloadSVG = event => {
)}.svg`
console.log('event', event);
};
export const onCopyMarkdown = event => {
event.target.select();
document.execCommand('Copy');
}
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))}`;
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))})`;
});
</script>
<style></style>
<style>
#markdown {
padding: 7px;
font-family: monospace;
font-size: 14px;
width: 300px;
}
label[for="markdown"] {
cursor: pointer;
color: -webkit-link;
color: -moz-link;
color: blue;
text-decoration: underline;
}
</style>
<div id="links" >
<a href="{url}" use:link>Link to view</a>
@@ -69,4 +89,8 @@ const unsubscribe = codeStore.subscribe( state => {
<a href="{url}" download='' on:click={onDownloadPNG}>
Download PNG
</a>
</div>
</div>
<p>
<label for="markdown">Copy Markdown</label>
<input id="markdown" type="text" value="{mdCode}" on:click={onCopyMarkdown} />
</p>
+4 -1
View File
@@ -113,6 +113,9 @@ let insertSvg = function(svgCode, bindFunctions){
border: 1px solor darkred;
flex: 1;
}
#container {
overflow-x: auto;
}
.error {
opacity: 0.5;
}
@@ -120,4 +123,4 @@ let insertSvg = function(svgCode, bindFunctions){
<div id="view" class="{codeClasses} {configClasses}">
<div id="container" bind:this={container}></div>
</div>
</div>
+4 -4
View File
@@ -2782,10 +2782,10 @@ merge-descriptors@1.0.1:
resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61"
integrity sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=
mermaid@8.4.4:
version "8.4.4"
resolved "https://registry.yarnpkg.com/mermaid/-/mermaid-8.4.4.tgz#7421fa204c8ee48e0fa0837985d1e612188ed3e6"
integrity sha512-exidY40uwtYZ8564Z1YtdElhfqUj/JTYNgbVs1fD1Zf7gIoIpSQke5U4bnSYe9ErMU1NO2Xt+C2VlfiV1har+A==
mermaid@8.4.5:
version "8.4.5"
resolved "https://registry.yarnpkg.com/mermaid/-/mermaid-8.4.5.tgz#48d5722cbc72be2ad01002795835d7ca1b48e000"
integrity sha512-oJWgZBtT2rvAdmqHvKjDwb3tOut1+ksfgDdZrVhhNcdzNibzGPjCsmMPpVXjkFYzKZCVunIbAkfxltSuaGIhaw==
dependencies:
"@braintree/sanitize-url" "^3.1.0"
crypto-random-string "^3.0.1"