Merge branch 'master' of https://github.com/mermaid-js/mermaid-live-editor into sidharthv96/cleanup
* 'master' of https://github.com/mermaid-js/mermaid-live-editor: Release Add deployment Fix header image Fix font path Update Monaco Editor
This commit is contained in:
@@ -32,41 +32,36 @@
|
||||
}
|
||||
};
|
||||
|
||||
const unsubscribe = codeStore.subscribe((state) => {
|
||||
if (editorElem === null) {
|
||||
console.log('Starting stuff', document.getElementById('editor-conf'));
|
||||
editorElem = document.getElementById('editor-conf');
|
||||
}
|
||||
if (!conf && state) {
|
||||
conf = JSON.stringify(state.mermaid, null, 2) || '{}';
|
||||
}
|
||||
if (state) {
|
||||
code = state.code;
|
||||
}
|
||||
if (!edit && conf && editorElem !== null) {
|
||||
edit = monaco.editor.create(editorElem, {
|
||||
value: [conf].join('\n'),
|
||||
theme: 'myCoolTheme',
|
||||
language: 'JSON',
|
||||
});
|
||||
resizeHandler = getResizeHandler(edit);
|
||||
edit.onDidChangeModelContent(function (e) {
|
||||
const conf = edit.getValue();
|
||||
handleConfUpdate(conf);
|
||||
});
|
||||
handleConfUpdate(conf);
|
||||
}
|
||||
});
|
||||
|
||||
initEditor(monaco);
|
||||
|
||||
onMount(async () => {
|
||||
console.log('Mounting config');
|
||||
self.MonacoEnvironment = {
|
||||
getWorkerUrl: function (moduleId, label) {
|
||||
return './editor.worker.bundle.js';
|
||||
},
|
||||
};
|
||||
|
||||
const unsubscribe = codeStore.subscribe((state) => {
|
||||
if (editorElem === null) {
|
||||
console.log('Starting stuff', document.getElementById('editor-conf'));
|
||||
editorElem = document.getElementById('editor-conf');
|
||||
}
|
||||
if (!conf && state) {
|
||||
conf = JSON.stringify(state.mermaid, null, 2);
|
||||
}
|
||||
if (state) {
|
||||
code = state.code;
|
||||
}
|
||||
if (!edit && conf && editorElem !== null) {
|
||||
edit = monaco.editor.create(editorElem, {
|
||||
value: [conf].join('\n'),
|
||||
theme: 'myCoolTheme',
|
||||
language: 'json',
|
||||
});
|
||||
resizeHandler = getResizeHandler(edit);
|
||||
edit.onDidChangeModelContent(function (e) {
|
||||
const conf = edit.getValue();
|
||||
handleConfUpdate(conf);
|
||||
});
|
||||
handleConfUpdate(conf);
|
||||
}
|
||||
});
|
||||
|
||||
initEditor(monaco);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
import mermaid from '@mermaid';
|
||||
import Error from './Error.svelte';
|
||||
import { getResizeHandler, initEditor } from './editor-utils';
|
||||
import 'monaco-editor/esm/vs/editor/browser/controller/coreCommands.js';
|
||||
import 'monaco-editor/esm/vs/editor/contrib/find/findController.js';
|
||||
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api.js';
|
||||
import * as monaco from 'monaco-editor';
|
||||
import { watchResize } from 'svelte-watch-resize';
|
||||
|
||||
export let code = '';
|
||||
@@ -60,12 +58,6 @@
|
||||
};
|
||||
|
||||
onMount(async () => {
|
||||
self.MonacoEnvironment = {
|
||||
getWorkerUrl: function (moduleId, label) {
|
||||
return './editor.worker.bundle.js';
|
||||
},
|
||||
};
|
||||
|
||||
const unsubscribe = codeStore.subscribe((state) => {
|
||||
console.log('Code change');
|
||||
if (editorElem === null) {
|
||||
|
||||
Reference in New Issue
Block a user