mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 23:13:02 +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,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
|
||||
Loading…
Add table
Add a link
Reference in a new issue