Extract playground samples from mdoc, add possiblity to run them from source

This commit is contained in:
Alex Dima 2016-09-06 12:34:53 +02:00
parent df6136ea12
commit 5b86272f55
103 changed files with 3126 additions and 21 deletions

View file

@ -0,0 +1,40 @@
var jsCodeArr = [
'// ------------------------------',
'// ------------------------------',
'function Person(age) {',
' if (age) {',
' this.age = age;',
' }',
'}',
'Person.prototype.getAge = function () {',
' return this.age;',
'};',
'',
''
];
jsCodeArr = jsCodeArr.concat(jsCodeArr.slice(0));
jsCodeArr = jsCodeArr.concat(jsCodeArr.slice(0));
jsCodeArr = jsCodeArr.concat(jsCodeArr.slice(0));
jsCodeArr[49] += 'And this is some long line. And this is some long line. And this is some long line. And this is some long line. And this is some long line. ';
var editor = monaco.editor.create(document.getElementById("container"), {
value: jsCodeArr.join('\n'),
language: "javascript"
});
editor.revealPositionInCenter({ lineNumber: 50, column: 120 });
// Also see:
// - editor.revealLine
// - editor.revealLineInCenter
// - editor.revealLineInCenterIfOutsideViewport
// - editor.revealLines
// - editor.revealLinesInCenter
// - editor.revealLinesInCenterIfOutsideViewport
// - editor.revealPosition
// - editor.revealPositionInCenter
// - editor.revealPositionInCenterIfOutsideViewport
// - editor.revealRange
// - editor.revealRangeInCenter
// - editor.revealRangeInCenterIfOutsideViewport