| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
- <title>Editor</title>
- <style type="text/css" media="screen">
- body {
- overflow: hidden;
- }
- #editor {
- margin: 0;
- position: absolute;
- top: 0;
- bottom: 0;
- left: 0;
- right: 0;
- }
- </style>
- </head>
- <body>
- <pre id="editor"></pre>
- <script src="./source/systemjs/system.js" type="text/javascript" charset="utf-8"></script>
- <script src="./source/monaco/vs/loader.js"></script>
- <script>
- System.config({
- "baseURL": "./",
- "defaultJSExtensions": true,
- // TODO: figure out how to make this be loaded in by the extension instead of being hard-coded in the html page
- meta: {
- './editorCore/modules/typescript.js': {
- format: 'global',
- exports: 'ts',
- }
- },
- map: {
- vs: 'source/monaco/vs'
- }
- });
- // Load up the monaco editor and set it up to be able to be configured
- require.config({
- paths: {
- 'vs': 'source/monaco/vs'
- }
- });
- /*window.MonacoEnvironment = {
- getWorkerUrl: function(workerId, label) {
- return 'source/monaco-editor-worker-loader-proxy.js';
- }
- };
- */
- var editorPromise = new Promise((resolve, reject) => {
- require(['vs/editor/editor.main'], function() {
- //var editor = monaco.editor.create(document.getElementById('editor'), {
- //language: 'typescript'
- //});
- var editor = monaco.editor.create(document.getElementById('editor'));
- System.import('./source/editorCore/interop').then((module) => {
- module.default.getInstance().setEditor(editor);
- resolve();
- });
- });
- });
- // Functions exposed to the host editor. These
- // are hooked in here so that they are available immediately from the host
- // and when called will bring in the interop as a promise and call it once
- // it has been loaded
- function HOST_loadCode(url) {
- editorPromise.then(() => {
- System.import('./source/editorCore/interop').then((module) => {
- module.default.getInstance().loadCode(url);
- });
- });
- }
- function HOST_saveCode() {
- System.import('./editorCore/interop').then((module) => {
- module.default.getInstance().saveCode();
- });
- }
- function HOST_resourceRenamed(path, newPath) {
- System.import('./editorCore/interop').then((module) => {
- module.default.getInstance().resourceRenamed(path, newPath);
- });
- }
- function HOST_resourceDeleted(path) {
- System.import('./editorCore/interop').then((module) => {
- module.default.getInstance().resourceDeleted(path);
- });
- }
- function HOST_preferencesChanged() {
- System.import('./editorCore/interop').then((module) => {
- module.default.getInstance().preferencesChanged();
- });
- }
- // System.import('./source/editorCore/interop').then((module) => {
- // module.default.getInstance().editorLoaded();
- // });
- </script>
- </body>
- </html>
|