mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 13:55:41 +01:00
Extract playground samples from mdoc, add possiblity to run them from source
This commit is contained in:
parent
df6136ea12
commit
5b86272f55
103 changed files with 3126 additions and 21 deletions
|
|
@ -0,0 +1 @@
|
|||
|
||||
|
|
@ -0,0 +1 @@
|
|||
<div id="container" style="height:100%"></div>
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
function lineNumbersFunc(originalLineNumber) {
|
||||
var map = [ 'O', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X'];
|
||||
if (originalLineNumber < map.length) {
|
||||
return map[originalLineNumber];
|
||||
}
|
||||
return originalLineNumber;
|
||||
}
|
||||
|
||||
var jsCode = [
|
||||
'"use strict";',
|
||||
'function Person(age) {',
|
||||
' if (age) {',
|
||||
' this.age = age;',
|
||||
' }',
|
||||
'}',
|
||||
'Person.prototype.getAge = function () {',
|
||||
' return this.age;',
|
||||
'};'
|
||||
].join('\n');
|
||||
|
||||
var editor = monaco.editor.create(document.getElementById("container"), {
|
||||
value: jsCode,
|
||||
language: "javascript",
|
||||
lineNumbers: lineNumbersFunc
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue