mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 15:05:39 +01:00
Move into monaco-editor-samples folder
This commit is contained in:
parent
b9969d41cb
commit
a9ab892f7a
86 changed files with 0 additions and 0 deletions
37
monaco-editor-samples/electron-amd/electron-index.html
Normal file
37
monaco-editor-samples/electron-amd/electron-index.html
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta
|
||||
http-equiv="Content-Security-Policy"
|
||||
content="default-src 'none'; script-src file: 'sha256-AcqnkP3xWRYJaQ27hijK3b831+qsxvzEoSYt6PfGrRE='; style-src 'unsafe-inline' file:; font-src file:"
|
||||
/>
|
||||
<title>Monaco Editor!</title>
|
||||
<style>
|
||||
#container {
|
||||
width: 500px;
|
||||
height: 300px;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Monaco Editor in Electron (without nodeIntegration)!</h1>
|
||||
Note: Since Electron without nodeIntegration is very similar to a browser, you can have a look
|
||||
at all the other `browser-` samples, as they should work just fine. <br /><br />
|
||||
<div id="container"></div>
|
||||
</body>
|
||||
|
||||
<script src="../node_modules/monaco-editor/min/vs/loader.js"></script>
|
||||
<script>
|
||||
require.config({ paths: { vs: '../node_modules/monaco-editor/min/vs' } });
|
||||
|
||||
require(['vs/editor/editor.main'], function () {
|
||||
const editor = monaco.editor.create(document.getElementById('container'), {
|
||||
value: ['function x() {', '\tconsole.log("Hello world!");', '}'].join('\n'),
|
||||
language: 'javascript'
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</html>
|
||||
18
monaco-editor-samples/electron-amd/index.html
Normal file
18
monaco-editor-samples/electron-amd/index.html
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
</head>
|
||||
<body>
|
||||
<h2>Monaco Editor Electron Sample</h2>
|
||||
|
||||
To run this sample, you need to
|
||||
<a href="https://github.com/electron/electron/releases">download Electron</a>
|
||||
and then execute:
|
||||
|
||||
<pre>
|
||||
$/electron-amd> electron main.js
|
||||
</pre
|
||||
>
|
||||
</body>
|
||||
</html>
|
||||
32
monaco-editor-samples/electron-amd/main.js
Normal file
32
monaco-editor-samples/electron-amd/main.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
const electron = require('electron');
|
||||
const app = electron.app;
|
||||
const BrowserWindow = electron.BrowserWindow;
|
||||
|
||||
let mainWindow;
|
||||
|
||||
function createWindow() {
|
||||
mainWindow = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
webPreferences: { worldSafeExecuteJavaScript: true }
|
||||
});
|
||||
mainWindow.loadURL(`file://${__dirname}/electron-index.html`);
|
||||
mainWindow.webContents.openDevTools();
|
||||
mainWindow.on('closed', function () {
|
||||
mainWindow = null;
|
||||
});
|
||||
}
|
||||
|
||||
app.on('ready', createWindow);
|
||||
|
||||
app.on('window-all-closed', function () {
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit();
|
||||
}
|
||||
});
|
||||
|
||||
app.on('activate', function () {
|
||||
if (mainWindow === null) {
|
||||
createWindow();
|
||||
}
|
||||
});
|
||||
4
monaco-editor-samples/electron-amd/package-lock.json
generated
Normal file
4
monaco-editor-samples/electron-amd/package-lock.json
generated
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"name": "electron-amd",
|
||||
"lockfileVersion": 1
|
||||
}
|
||||
7
monaco-editor-samples/electron-amd/package.json
Normal file
7
monaco-editor-samples/electron-amd/package.json
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"name": "electron-amd",
|
||||
"scripts": {
|
||||
"execute": "node ../node_modules/electron/cli.js ."
|
||||
},
|
||||
"main": "./main"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue