You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
monaco-editor/website/playground/new-samples/interacting-with-the-editor/customizing-the-line-numbers/sample.js

26 lines
581 B
JavaScript

function lineNumbersFunc(originalLineNumber) {
3 years ago
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');
3 years ago
var editor = monaco.editor.create(document.getElementById('container'), {
value: jsCode,
3 years ago
language: 'javascript',
lineNumbers: lineNumbersFunc
});