0
Dies ist ein Code-Schnipsel in einer test.html
Datei.Wie setze ich den Pfad für Dateien im Monaco Editor?
<script src="monaco-editor/min/vs/loader.js"></script>
<script>
\t require.config({ paths: { 'vs': 'monaco-editor/min/vs' }});
\t require(['vs/editor/editor.main'], function() {
\t \t var editor = monaco.editor.create(document.getElementById('container'), {
\t \t \t value: [
\t \t \t \t 'function x() {',
\t \t \t \t '\tconsole.log("Hello world!");',
\t \t \t \t '}'
\t \t \t ].join('\n'),
\t \t \t language: 'javascript'
\t \t });
\t });
</script>
dies ist ein Dateibaum auf meinem System.
ide ├── cpp14 │ ├── test.html ├── monaco └── node_modules ├── monaco-editor └── test.html
Ich kopierte test.html
Datei monaco/node_moules/
-cpp14
Und verändert alle Wege in cpp14/test.html
zu
<script src="ide/monaco/node_modules/monaco-editor/min/vs/loader.js"></script>
<script>
\t require.config({ paths: { 'vs': 'ide/monaco/node_modules/monaco-editor/min/vs' }});
\t require(['ide/monaco/node_modules/monaco-editor/min/vs/editor/editor.main'], function() {
\t \t var editor = monaco.editor.create(document.getElementById('container'), {
\t \t \t value: [
\t \t \t \t 'function x() {',
\t \t \t \t '\tconsole.log("Hello world!");',
\t \t \t \t '}'
\t \t \t ].join('\n'),
\t \t \t language: 'javascript'
\t \t });
});
Dies funktioniert nicht, und ich glaube, es ist ein Irrtum r im Einstellungspfad dieser Dateien im Snippet. Wie funktioniert das?