Skip to content

Commit

Permalink
Merge pull request mermaid-js#179 from mermaid-js/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
sidharthv96 authored Jun 3, 2021
2 parents 6622cb3 + 4d6a247 commit b431571
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
[ "$GITHUB_EVENT_NAME" == "pull_request" ] && export BETA=true && rm -rf docs/beta/
[ "$GITHUB_EVENT_NAME" != "pull_request" ] && rm -rf docs/_app/
yarn install
yarn run lint
# yarn run lint
version=$(yarn version --patch --no-git-tag-version | grep "New version" | cut -d':' -f 2)
yarn build
cd bin
Expand Down
4 changes: 2 additions & 2 deletions cypress/snapshots.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ module.exports = {
"1": "{\"code\":\"graph TD\\n A[Christmas] -->|Get money| B(Go shopping)\\n B --> C{Let me think}\\n C -->|One| D[Laptop]\\n C -->|Two| E[iPhone]\\n C -->|Three| F[fa:fa-car Car]\\n \",\"mermaid\":\"{\\n \\\"theme\\\": \\\"default\\\"\\n}\",\"updateEditor\":true,\"autoSync\":true,\"updateDiagram\":true}"
},
"Check Redirect from old URL": {
"1": "{\"code\":\"graph TD\\n A[Christmas] -->|Get money| B(Go shopping)\\n B --> C{Let me think}\\n C -->|One| D[Laptop]\\n C -->|Two| E[iPhone]\\n C -->|Three| F[fa:fa-car Car]\",\"mermaid\":\"{\\n \\\"theme\\\": \\\"default\\\"\\n}\",\"updateEditor\":true,\"autoSync\":true,\"updateDiagram\":true}"
"1": "{\"code\":\"graph TD\\n A[Christmas] -->|Get money| B(Go shopping)\\n B --> C{Let me think}\\n C -->|One| D[Laptop]\\n C -->|Two| E[iPhone]\\n C -->|Three| F[fa:fa-car Car]\",\"mermaid\":\"{\\n \\\"theme\\\": \\\"default\\\"\\n}\",\"updateEditor\":false,\"autoSync\":true,\"updateDiagram\":false}"
}
},
"__version": "7.4.0",
"__version": "7.3.0",
"Auto sync tests": {
"should dim diagram when code is edited": {
"1": "{\"code\":\"graph TD\\n A[Christmas] -->|Get money| B(Go shopping)\\n B --> C{Let me think}\\n C -->|One| D[Laptop]\\n C -->|Two| E[iPhone]\\n C -->|Three| F[fa:fa-car Car]\\n C --> Test\",\"mermaid\":\"{\\n \\\"theme\\\": \\\"default\\\"\\n}\",\"updateEditor\":false,\"autoSync\":false,\"updateDiagram\":false}"
Expand Down
11 changes: 8 additions & 3 deletions src/lib/components/editor/editor.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
};
export let errorMarkers: monaco.editor.IMarkerData[] = [];
let oldText = text;
$: editor && Monaco?.editor.setModelLanguage(editor.getModel(), language);
$: Monaco?.editor.setModelLanguage(editor.getModel(), language);
$: {
if (text !== oldText) {
if ($codeStore.updateEditor) {
editor?.setValue(text);
}
oldText = text;
}
editor && Monaco?.editor.setModelMarkers(editor.getModel(), 'test', errorMarkers);
Monaco?.editor.setModelMarkers(editor.getModel(), 'test', errorMarkers);
}
const dispatch = createEventDispatcher<EditorEvents>();
Expand All @@ -49,7 +49,12 @@
alert('Loading Monaco Editor failed. Please try refreshing the page.');
};
onMount(async () => {
await loadMonaco(); // Fix https://github.com/mermaid-js/mermaid-live-editor/issues/175
try {
//@ts-ignore : This is a hack to handle a svelte-kit error when importing monaco.
Monaco = monaco;
} catch {
await loadMonaco(); // Fix https://github.com/mermaid-js/mermaid-live-editor/issues/175
}
initEditor(Monaco);
editor = Monaco.editor.create(divEl, editorOptions);
editor.onDidChangeModelContent(() => {
Expand Down

0 comments on commit b431571

Please sign in to comment.