mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 22:02:55 +01:00
Merge pull request #44 from orta/store_code
Let changes to the test file persist
This commit is contained in:
commit
155292c59d
1 changed files with 21 additions and 9 deletions
|
|
@ -33,12 +33,9 @@
|
|||
<script src="../node_modules/monaco-editor-core/dev/vs/editor/editor.main.js"></script>
|
||||
|
||||
<script>
|
||||
require([
|
||||
'vs/basic-languages/monaco.contribution',
|
||||
'vs/language/typescript/monaco.contribution'
|
||||
], function() {
|
||||
var editor = monaco.editor.create(document.getElementById('container'), {
|
||||
value: [
|
||||
let text = localStorage.getItem("code")
|
||||
if (!text) {
|
||||
text = [
|
||||
'/* Game of Life',
|
||||
' * Implemented in TypeScript',
|
||||
' * To learn more about TypeScript, please visit http://www.typescriptlang.org/',
|
||||
|
|
@ -164,11 +161,26 @@
|
|||
'',
|
||||
'var game = new Conway.GameOfLife();',
|
||||
|
||||
].join('\n'),
|
||||
language: 'typescript'
|
||||
].join('\n')
|
||||
}
|
||||
|
||||
require([
|
||||
'vs/basic-languages/monaco.contribution',
|
||||
'vs/language/typescript/monaco.contribution'
|
||||
], function() {
|
||||
|
||||
var editor = monaco.editor.create(document.getElementById('container'), {
|
||||
value: text,
|
||||
language: 'typescript',
|
||||
lightbulb: { enabled: true }
|
||||
});
|
||||
|
||||
editor.onDidChangeModelContent(() => {
|
||||
const code = editor.getModel().getValue()
|
||||
localStorage.setItem("code", code)
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue