-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.html
72 lines (67 loc) · 2.21 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Unicycle</title>
<link rel="stylesheet" href="./node_modules/antd/dist/antd.min.css">
<link rel="stylesheet" data-name="vs/editor/editor.main" href="./node_modules/monaco-editor/min/vs/editor/editor.main.css">
<link rel="stylesheet" href="./style.css">
<script src="./node_modules/mousetrap/mousetrap.min.js"></script>
</head>
<body>
<div id="app">
<div id="loading">
<div class="ant-spin ant-spin-spinning">
<span class="ant-spin-dot">
<i></i>
<i></i>
<i></i>
<i></i>
</span>
</div>
</div>
</div>
<script>
// Monaco uses a custom amd loader that over-rides node's require.
// Keep a reference to node's require so we can restore it after executing the amd loader file.
var nodeRequire = global.require;
</script>
<script src="./node_modules/monaco-editor/min/vs/loader.js"></script>
<script>
// Save Monaco's amd require and restore Node's require
var amdRequire = global.require;
global.require = nodeRequire;
</script>
<script>
// require node modules before loader.js comes in
var path = require('path')
function uriFromPath(_path) {
var pathName = path.resolve(_path).replace(/\\/g, '/')
if (pathName.length > 0 && pathName.charAt(0) !== '/') {
pathName = '/' + pathName
}
return encodeURI('file://' + pathName)
}
amdRequire.config({
baseUrl: uriFromPath(path.join(__dirname, './node_modules/monaco-editor/min'))
})
// workaround monaco-css not understanding the environment
self.module = undefined
// workaround monaco-typescript not understanding the environment
self.process.browser = true
amdRequire(['vs/editor/editor.main'], function () {
nodeRequire('./lib/renderer.js')
})
</script>
<script>
const disableDragAndDrop = (e) => {
if (e.target.classList.contains('drop-zone')) return
e.preventDefault()
e.dataTransfer.effectAllowed = 'none'
e.dataTransfer.dropEffect = 'none'
}
window.addEventListener('dragover', disableDragAndDrop, false)
window.addEventListener('drop', disableDragAndDrop, false)
</script>
</body>
</html>