Merge branch 'monaco-editor' into 'master'
Support Monaco Editor See merge request pastebin.run/server!51
This commit is contained in:
commit
51fcec38ee
|
@ -13,6 +13,12 @@ export const types = {
|
||||||
return (await import('./views/editor-types/codemirror/codemirror')).default
|
return (await import('./views/editor-types/codemirror/codemirror')).default
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
monaco: {
|
||||||
|
name: 'Monaco (Visual Studio Code)',
|
||||||
|
async createView() {
|
||||||
|
return (await import('./views/editor-types/monaco/monaco')).default
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getCurrentEditor() {
|
export async function getCurrentEditor() {
|
||||||
|
|
6
js/views/editor-types/monaco/monaco.css
Normal file
6
js/views/editor-types/monaco/monaco.css
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
.monaco {
|
||||||
|
border: 1px solid #bbbdbe;
|
||||||
|
height: auto;
|
||||||
|
font-size: 14.4px;
|
||||||
|
height: 372px;
|
||||||
|
}
|
83
js/views/editor-types/monaco/monaco.js
Normal file
83
js/views/editor-types/monaco/monaco.js
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
import * as monaco from 'monaco-editor'
|
||||||
|
import './monaco.css'
|
||||||
|
|
||||||
|
function getWorkerName(label) {
|
||||||
|
if (label === 'json' || label === 'css' || label === 'html') {
|
||||||
|
return label
|
||||||
|
}
|
||||||
|
if (label === 'typescript' || label === 'javascript') {
|
||||||
|
return 'typescript'
|
||||||
|
}
|
||||||
|
return 'editor'
|
||||||
|
}
|
||||||
|
|
||||||
|
self.MonacoEnvironment = {
|
||||||
|
getWorkerUrl(_moduleId, label) {
|
||||||
|
return `/static/js/${getWorkerName(label)}.worker.js`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const languageMap = {
|
||||||
|
'c': 'objective-c', // Somehow the repo doesn't have C language
|
||||||
|
'c-plus-plus': 'cpp',
|
||||||
|
'c-sharp': 'csharp',
|
||||||
|
'haskell': null,
|
||||||
|
'html': 'html',
|
||||||
|
'java': 'java',
|
||||||
|
'javascript': 'javascript',
|
||||||
|
'jinja2': null,
|
||||||
|
'jsx': 'javascript',
|
||||||
|
'markdown': 'markdown',
|
||||||
|
'perl': 'perl',
|
||||||
|
'perl6': null,
|
||||||
|
'php': 'php',
|
||||||
|
'postgresql': 'sql',
|
||||||
|
'python2': 'python',
|
||||||
|
'python3': 'python',
|
||||||
|
'rust': 'rust',
|
||||||
|
'sh': 'shell',
|
||||||
|
'sql': 'sql',
|
||||||
|
'sqlite': 'sql',
|
||||||
|
'typescript': 'typescript',
|
||||||
|
'typescript-jsx': 'typescript',
|
||||||
|
}
|
||||||
|
|
||||||
|
class MonacoEditor {
|
||||||
|
constructor(textarea, container, editor) {
|
||||||
|
this.textarea = textarea
|
||||||
|
this.container = container
|
||||||
|
this.editor = editor
|
||||||
|
}
|
||||||
|
|
||||||
|
setLanguage(identifier) {
|
||||||
|
monaco.editor.setModelLanguage(this.editor.getModel(), languageMap[identifier])
|
||||||
|
}
|
||||||
|
|
||||||
|
getValue() {
|
||||||
|
return this.editor.getValue()
|
||||||
|
}
|
||||||
|
|
||||||
|
setValue(value) {
|
||||||
|
this.editor.setValue(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
unload() {
|
||||||
|
this.editor.dispose()
|
||||||
|
this.container.remove()
|
||||||
|
this.textarea.style.display = 'inline'
|
||||||
|
this.editor.toTextArea()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function createMonacoEditor(textarea, onChange) {
|
||||||
|
const container = document.createElement('div')
|
||||||
|
container.className = 'monaco'
|
||||||
|
textarea.before(container)
|
||||||
|
textarea.style.display = 'none'
|
||||||
|
const editor = monaco.editor.create(container, {
|
||||||
|
value: textarea.value,
|
||||||
|
})
|
||||||
|
editor.onDidChangeModelContent(onChange)
|
||||||
|
textarea.form.addEventListener('submit', () => textarea.value = editor.getValue())
|
||||||
|
return new MonacoEditor(textarea, container, editor)
|
||||||
|
}
|
|
@ -10,7 +10,7 @@ class Editor {
|
||||||
this.wrapperButtons = new WrapperButtons(form.querySelector('#wrapper-buttons'), this.run.bind(this))
|
this.wrapperButtons = new WrapperButtons(form.querySelector('#wrapper-buttons'), this.run.bind(this))
|
||||||
this.codeElement = form.querySelector('#code')
|
this.codeElement = form.querySelector('#code')
|
||||||
this.initializeEditor(createTextareaEditor)
|
this.initializeEditor(createTextareaEditor)
|
||||||
this.initCodeMirrorEditor()
|
this.initConfiguredEditor()
|
||||||
this.output = new Output(output)
|
this.output = new Output(output)
|
||||||
this.autodeleteText = form.querySelector('#autodelete-text')
|
this.autodeleteText = form.querySelector('#autodelete-text')
|
||||||
this.autodeleteCheckbox = form.querySelector('#automatically-hidden-label')
|
this.autodeleteCheckbox = form.querySelector('#automatically-hidden-label')
|
||||||
|
@ -23,17 +23,17 @@ class Editor {
|
||||||
this.updateLanguage()
|
this.updateLanguage()
|
||||||
}
|
}
|
||||||
|
|
||||||
async initCodeMirrorEditor() {
|
async initConfiguredEditor() {
|
||||||
this.changeEditor(await types[await getCurrentEditor()].createView())
|
this.changeEditor(await types[await getCurrentEditor()].createView())
|
||||||
}
|
}
|
||||||
|
|
||||||
changeEditor(createTextareaEditor) {
|
changeEditor(createEditor) {
|
||||||
this.editor.unload()
|
this.editor.unload()
|
||||||
this.initializeEditor(createTextareaEditor)
|
this.initializeEditor(createEditor)
|
||||||
}
|
}
|
||||||
|
|
||||||
initializeEditor(createTextareaEditor) {
|
initializeEditor(createEditor) {
|
||||||
this.editor = createTextareaEditor(this.codeElement, () => this.changeToLookLikeNewPaste())
|
this.editor = createEditor(this.codeElement, () => this.changeToLookLikeNewPaste())
|
||||||
if (this.currentLanguage) {
|
if (this.currentLanguage) {
|
||||||
this.editor.setLanguage(this.currentLanguage)
|
this.editor.setLanguage(this.currentLanguage)
|
||||||
}
|
}
|
||||||
|
|
301
package-lock.json
generated
301
package-lock.json
generated
|
@ -3,6 +3,88 @@
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@types/anymatch": {
|
||||||
|
"version": "1.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/anymatch/-/anymatch-1.3.1.tgz",
|
||||||
|
"integrity": "sha512-/+CRPXpBDpo2RK9C68N3b2cOvO0Cf5B9aPijHsoDQTHivnGSObdOF2BRQOYjojWTDy6nQvMjmqRXIxH55VjxxA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"@types/node": {
|
||||||
|
"version": "12.7.12",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.12.tgz",
|
||||||
|
"integrity": "sha512-KPYGmfD0/b1eXurQ59fXD1GBzhSQfz6/lKBxkaHX9dKTzjXbK68Zt7yGUxUsCS1jeTy/8aL+d9JEr+S54mpkWQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"@types/source-list-map": {
|
||||||
|
"version": "0.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/source-list-map/-/source-list-map-0.1.2.tgz",
|
||||||
|
"integrity": "sha512-K5K+yml8LTo9bWJI/rECfIPrGgxdpeNbj+d53lwN4QjW1MCwlkhUms+gtdzigTeUyBr09+u8BwOIY3MXvHdcsA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"@types/tapable": {
|
||||||
|
"version": "1.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/tapable/-/tapable-1.0.4.tgz",
|
||||||
|
"integrity": "sha512-78AdXtlhpCHT0K3EytMpn4JNxaf5tbqbLcbIRoQIHzpTIyjpxLQKRoxU55ujBXAtg3Nl2h/XWvfDa9dsMOd0pQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"@types/uglify-js": {
|
||||||
|
"version": "3.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/uglify-js/-/uglify-js-3.0.4.tgz",
|
||||||
|
"integrity": "sha512-SudIN9TRJ+v8g5pTG8RRCqfqTMNqgWCKKd3vtynhGzkIIjxaicNAMuY5TRadJ6tzDu3Dotf3ngaMILtmOdmWEQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"source-map": "^0.6.1"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"source-map": {
|
||||||
|
"version": "0.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||||
|
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@types/webpack": {
|
||||||
|
"version": "4.39.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/webpack/-/webpack-4.39.3.tgz",
|
||||||
|
"integrity": "sha512-afGNNuTfKk1YfHrQ+IwF0QhDkSSMIMMt8BRRErTKaGVvWTMABDjT22/4kJ4bRoSzir9LVgxuuceyZ4Z5I82Cyg==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@types/anymatch": "*",
|
||||||
|
"@types/node": "*",
|
||||||
|
"@types/tapable": "*",
|
||||||
|
"@types/uglify-js": "*",
|
||||||
|
"@types/webpack-sources": "*",
|
||||||
|
"source-map": "^0.6.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"source-map": {
|
||||||
|
"version": "0.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||||
|
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@types/webpack-sources": {
|
||||||
|
"version": "0.1.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/webpack-sources/-/webpack-sources-0.1.5.tgz",
|
||||||
|
"integrity": "sha512-zfvjpp7jiafSmrzJ2/i3LqOyTYTuJ7u1KOXlKgDlvsj9Rr0x7ZiYu5lZbXwobL7lmsRNtPXlBfmaUD8eU2Hu8w==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@types/node": "*",
|
||||||
|
"@types/source-list-map": "*",
|
||||||
|
"source-map": "^0.6.1"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"source-map": {
|
||||||
|
"version": "0.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||||
|
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"@webassemblyjs/ast": {
|
"@webassemblyjs/ast": {
|
||||||
"version": "1.8.5",
|
"version": "1.8.5",
|
||||||
"resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.8.5.tgz",
|
"resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.8.5.tgz",
|
||||||
|
@ -423,9 +505,9 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"bluebird": {
|
"bluebird": {
|
||||||
"version": "3.5.5",
|
"version": "3.7.0",
|
||||||
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.5.tgz",
|
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.0.tgz",
|
||||||
"integrity": "sha512-5am6HnnfN+urzt4yfg7IgTbotDjIT/u8AJpEt0sIU9FtXfVeezXAPKswrG+xKUCOYAINpSdgZVDU6QFh+cuH3w==",
|
"integrity": "sha512-aBQ1FxIa7kSWCcmKHlcHFlT2jt6J/l4FzC7KcPELkOJOsPOb/bccdhmIrKDfXhwFrmc7vDoDrrepFvGqjyXGJg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"bn.js": {
|
"bn.js": {
|
||||||
|
@ -579,29 +661,6 @@
|
||||||
"integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=",
|
"integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"cacache": {
|
|
||||||
"version": "12.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/cacache/-/cacache-12.0.3.tgz",
|
|
||||||
"integrity": "sha512-kqdmfXEGFepesTuROHMs3MpFLWrPkSSpRqOw80RCflZXy/khxaArvFrQ7uJxSUduzAufc6G0g1VUCOZXxWavPw==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"bluebird": "^3.5.5",
|
|
||||||
"chownr": "^1.1.1",
|
|
||||||
"figgy-pudding": "^3.5.1",
|
|
||||||
"glob": "^7.1.4",
|
|
||||||
"graceful-fs": "^4.1.15",
|
|
||||||
"infer-owner": "^1.0.3",
|
|
||||||
"lru-cache": "^5.1.1",
|
|
||||||
"mississippi": "^3.0.0",
|
|
||||||
"mkdirp": "^0.5.1",
|
|
||||||
"move-concurrently": "^1.0.1",
|
|
||||||
"promise-inflight": "^1.0.1",
|
|
||||||
"rimraf": "^2.6.3",
|
|
||||||
"ssri": "^6.0.1",
|
|
||||||
"unique-filename": "^1.1.1",
|
|
||||||
"y18n": "^4.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"cache-base": {
|
"cache-base": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz",
|
||||||
|
@ -668,9 +727,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"chownr": {
|
"chownr": {
|
||||||
"version": "1.1.2",
|
"version": "1.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.3.tgz",
|
||||||
"integrity": "sha512-GkfeAQh+QNy3wquu9oIZr6SS5x7wGdSgNQvD10X3r+AZr1Oys22HW8kAmDMvNg2+Dm0TeGaEuO8gFwdBXxwO8A==",
|
"integrity": "sha512-i70fVHhmV3DtTl6nqvZOnIjbY0Pe4kAUjwHj8z0zAdgBtYrJyYwLKCCuRBQ5ppkyL0AkN7HKRnETdmdp1zqNXw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"chrome-trace-event": {
|
"chrome-trace-event": {
|
||||||
|
@ -758,9 +817,9 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"commander": {
|
"commander": {
|
||||||
"version": "2.20.0",
|
"version": "2.20.1",
|
||||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz",
|
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.1.tgz",
|
||||||
"integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==",
|
"integrity": "sha512-cCuLsMhJeWQ/ZpsFTbE765kvVfoeSddc4nU3up4fV+fDBcfUXnbITJ+JzhkdjzOqhURjZgujxaioam4RM9yGUg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"commondir": {
|
"commondir": {
|
||||||
|
@ -1349,17 +1408,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"find-cache-dir": {
|
|
||||||
"version": "2.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.1.0.tgz",
|
|
||||||
"integrity": "sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"commondir": "^1.0.1",
|
|
||||||
"make-dir": "^2.0.0",
|
|
||||||
"pkg-dir": "^3.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"find-up": {
|
"find-up": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
|
||||||
|
@ -2482,16 +2530,14 @@
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"yallist": "^3.0.2"
|
"yallist": "^3.0.2"
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"make-dir": {
|
"dependencies": {
|
||||||
"version": "2.1.0",
|
"yallist": {
|
||||||
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz",
|
"version": "3.1.1",
|
||||||
"integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==",
|
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
|
||||||
"dev": true,
|
"integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
|
||||||
"requires": {
|
"dev": true
|
||||||
"pify": "^4.0.1",
|
}
|
||||||
"semver": "^5.6.0"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"mamacro": {
|
"mamacro": {
|
||||||
|
@ -2676,6 +2722,21 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"monaco-editor": {
|
||||||
|
"version": "0.18.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.18.1.tgz",
|
||||||
|
"integrity": "sha512-fmL+RFZ2Hrezy+X/5ZczQW51LUmvzfcqOurnkCIRFTyjdVjzR7JvENzI6+VKBJzJdPh6EYL4RoWl92b2Hrk9fw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"monaco-editor-webpack-plugin": {
|
||||||
|
"version": "1.7.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/monaco-editor-webpack-plugin/-/monaco-editor-webpack-plugin-1.7.0.tgz",
|
||||||
|
"integrity": "sha512-oItymcnlL14Sjd7EF7q+CMhucfwR/2BxsqrXIBrWL6LQplFfAfV+grLEQRmVHeGSBZ/Gk9ptzfueXnWcoEcFuA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@types/webpack": "^4.4.19"
|
||||||
|
}
|
||||||
|
},
|
||||||
"move-concurrently": {
|
"move-concurrently": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz",
|
||||||
|
@ -3379,12 +3440,6 @@
|
||||||
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
|
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"serialize-javascript": {
|
|
||||||
"version": "1.9.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-1.9.1.tgz",
|
|
||||||
"integrity": "sha512-0Vb/54WJ6k5v8sSWN09S0ora+Hnr+cX40r9F170nT+mSkaxltoE/7R3OrIdBSUv1OoiobH1QoWQbCnAO+e8J1A==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"set-blocking": {
|
"set-blocking": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
|
||||||
|
@ -3616,15 +3671,6 @@
|
||||||
"extend-shallow": "^3.0.0"
|
"extend-shallow": "^3.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ssri": {
|
|
||||||
"version": "6.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/ssri/-/ssri-6.0.1.tgz",
|
|
||||||
"integrity": "sha512-3Wge10hNcT1Kur4PDFwEieXSCMCJs/7WvSACcrMYrNp+b8kDL1/0wJch5Ni2WrtwEa2IO8OsVfeKIciKCDx/QA==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"figgy-pudding": "^3.5.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"static-extend": {
|
"static-extend": {
|
||||||
"version": "0.1.2",
|
"version": "0.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz",
|
||||||
|
@ -3758,9 +3804,9 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"terser": {
|
"terser": {
|
||||||
"version": "4.3.1",
|
"version": "4.3.8",
|
||||||
"resolved": "https://registry.npmjs.org/terser/-/terser-4.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/terser/-/terser-4.3.8.tgz",
|
||||||
"integrity": "sha512-pnzH6dnFEsR2aa2SJaKb1uSCl3QmIsJ8dEkj0Fky+2AwMMcC9doMqLOQIH6wVTEKaVfKVvLSk5qxPBEZT9mywg==",
|
"integrity": "sha512-otmIRlRVmLChAWsnSFNO0Bfk6YySuBp6G9qrHiJwlLDd4mxe2ta4sjI7TzIR+W1nBMjilzrMcPOz9pSusgx3hQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"commander": "^2.20.0",
|
"commander": "^2.20.0",
|
||||||
|
@ -3776,31 +3822,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"terser-webpack-plugin": {
|
|
||||||
"version": "1.4.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-1.4.1.tgz",
|
|
||||||
"integrity": "sha512-ZXmmfiwtCLfz8WKZyYUuuHf3dMYEjg8NrjHMb0JqHVHVOSkzp3cW2/XG1fP3tRhqEqSzMwzzRQGtAPbs4Cncxg==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"cacache": "^12.0.2",
|
|
||||||
"find-cache-dir": "^2.1.0",
|
|
||||||
"is-wsl": "^1.1.0",
|
|
||||||
"schema-utils": "^1.0.0",
|
|
||||||
"serialize-javascript": "^1.7.0",
|
|
||||||
"source-map": "^0.6.1",
|
|
||||||
"terser": "^4.1.2",
|
|
||||||
"webpack-sources": "^1.4.0",
|
|
||||||
"worker-farm": "^1.7.0"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"source-map": {
|
|
||||||
"version": "0.6.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
|
||||||
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
|
||||||
"dev": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"through2": {
|
"through2": {
|
||||||
"version": "2.0.5",
|
"version": "2.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz",
|
||||||
|
@ -4082,6 +4103,90 @@
|
||||||
"terser-webpack-plugin": "^1.4.1",
|
"terser-webpack-plugin": "^1.4.1",
|
||||||
"watchpack": "^1.6.0",
|
"watchpack": "^1.6.0",
|
||||||
"webpack-sources": "^1.4.1"
|
"webpack-sources": "^1.4.1"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"cacache": {
|
||||||
|
"version": "12.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/cacache/-/cacache-12.0.3.tgz",
|
||||||
|
"integrity": "sha512-kqdmfXEGFepesTuROHMs3MpFLWrPkSSpRqOw80RCflZXy/khxaArvFrQ7uJxSUduzAufc6G0g1VUCOZXxWavPw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"bluebird": "^3.5.5",
|
||||||
|
"chownr": "^1.1.1",
|
||||||
|
"figgy-pudding": "^3.5.1",
|
||||||
|
"glob": "^7.1.4",
|
||||||
|
"graceful-fs": "^4.1.15",
|
||||||
|
"infer-owner": "^1.0.3",
|
||||||
|
"lru-cache": "^5.1.1",
|
||||||
|
"mississippi": "^3.0.0",
|
||||||
|
"mkdirp": "^0.5.1",
|
||||||
|
"move-concurrently": "^1.0.1",
|
||||||
|
"promise-inflight": "^1.0.1",
|
||||||
|
"rimraf": "^2.6.3",
|
||||||
|
"ssri": "^6.0.1",
|
||||||
|
"unique-filename": "^1.1.1",
|
||||||
|
"y18n": "^4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"find-cache-dir": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.1.0.tgz",
|
||||||
|
"integrity": "sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"commondir": "^1.0.1",
|
||||||
|
"make-dir": "^2.0.0",
|
||||||
|
"pkg-dir": "^3.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"make-dir": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz",
|
||||||
|
"integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"pify": "^4.0.1",
|
||||||
|
"semver": "^5.6.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"serialize-javascript": {
|
||||||
|
"version": "1.9.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-1.9.1.tgz",
|
||||||
|
"integrity": "sha512-0Vb/54WJ6k5v8sSWN09S0ora+Hnr+cX40r9F170nT+mSkaxltoE/7R3OrIdBSUv1OoiobH1QoWQbCnAO+e8J1A==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"source-map": {
|
||||||
|
"version": "0.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||||
|
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"ssri": {
|
||||||
|
"version": "6.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/ssri/-/ssri-6.0.1.tgz",
|
||||||
|
"integrity": "sha512-3Wge10hNcT1Kur4PDFwEieXSCMCJs/7WvSACcrMYrNp+b8kDL1/0wJch5Ni2WrtwEa2IO8OsVfeKIciKCDx/QA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"figgy-pudding": "^3.5.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"terser-webpack-plugin": {
|
||||||
|
"version": "1.4.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-1.4.1.tgz",
|
||||||
|
"integrity": "sha512-ZXmmfiwtCLfz8WKZyYUuuHf3dMYEjg8NrjHMb0JqHVHVOSkzp3cW2/XG1fP3tRhqEqSzMwzzRQGtAPbs4Cncxg==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"cacache": "^12.0.2",
|
||||||
|
"find-cache-dir": "^2.1.0",
|
||||||
|
"is-wsl": "^1.1.0",
|
||||||
|
"schema-utils": "^1.0.0",
|
||||||
|
"serialize-javascript": "^1.7.0",
|
||||||
|
"source-map": "^0.6.1",
|
||||||
|
"terser": "^4.1.2",
|
||||||
|
"webpack-sources": "^1.4.0",
|
||||||
|
"worker-farm": "^1.7.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"webpack-cli": {
|
"webpack-cli": {
|
||||||
|
@ -4174,12 +4279,6 @@
|
||||||
"integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==",
|
"integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"yallist": {
|
|
||||||
"version": "3.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz",
|
|
||||||
"integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"yargs": {
|
"yargs": {
|
||||||
"version": "13.2.4",
|
"version": "13.2.4",
|
||||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-13.2.4.tgz",
|
"resolved": "https://registry.npmjs.org/yargs/-/yargs-13.2.4.tgz",
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"codemirror": "^5.49.0",
|
"codemirror": "^5.49.0",
|
||||||
"css-loader": "^3.2.0",
|
"css-loader": "^3.2.0",
|
||||||
|
"monaco-editor": "^0.18.1",
|
||||||
|
"monaco-editor-webpack-plugin": "^1.7.0",
|
||||||
"style-loader": "^1.0.0",
|
"style-loader": "^1.0.0",
|
||||||
"webpack": "^4.40.2",
|
"webpack": "^4.40.2",
|
||||||
"webpack-cli": "^3.3.9"
|
"webpack-cli": "^3.3.9"
|
||||||
|
|
|
@ -121,7 +121,7 @@ pub fn routes(
|
||||||
"script-src 'self'; ",
|
"script-src 'self'; ",
|
||||||
"style-src 'self' 'unsafe-inline'; ",
|
"style-src 'self' 'unsafe-inline'; ",
|
||||||
"connect-src 'self'; ",
|
"connect-src 'self'; ",
|
||||||
"img-src *; ",
|
"img-src * data:; ",
|
||||||
"object-src 'none'; ",
|
"object-src 'none'; ",
|
||||||
"base-uri 'none'; ",
|
"base-uri 'none'; ",
|
||||||
"form-action 'self'; ",
|
"form-action 'self'; ",
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
const MonacoWebpackPlugin = require("monaco-editor-webpack-plugin");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: './js/index',
|
entry: './js/index',
|
||||||
output: {
|
output: {
|
||||||
|
@ -12,4 +14,25 @@ module.exports = {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
plugins: [
|
||||||
|
new MonacoWebpackPlugin({
|
||||||
|
output: 'static/js',
|
||||||
|
languages: [
|
||||||
|
'csharp',
|
||||||
|
'cpp',
|
||||||
|
'html',
|
||||||
|
'java',
|
||||||
|
'javascript',
|
||||||
|
'markdown',
|
||||||
|
'objective-c',
|
||||||
|
'perl',
|
||||||
|
'php',
|
||||||
|
'python',
|
||||||
|
'rust',
|
||||||
|
'shell',
|
||||||
|
'sql',
|
||||||
|
'typescript',
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user