|
@@ -337,21 +337,18 @@ var editor = monaco.editor.create(document.getElementById("container"), {
|
|
|
glyphMargin: true
|
|
|
});
|
|
|
|
|
|
-var decorationId = editor.changeDecorations(function(changeAccessor) {
|
|
|
- return changeAccessor.addDecoration({
|
|
|
- startLineNumber: 3,
|
|
|
- startColumn: 1,
|
|
|
- endLineNumber: 3,
|
|
|
- endColumn: 1
|
|
|
- }, {
|
|
|
- isWholeLine: true,
|
|
|
- className: 'myContentClass',
|
|
|
- glyphMarginClassName: 'myGlyphMarginClass'
|
|
|
- });
|
|
|
-});
|
|
|
-
|
|
|
+var decorations = editor.deltaDecorations([], [
|
|
|
+ {
|
|
|
+ range: new monaco.Range(3,1,3,1),
|
|
|
+ options: {
|
|
|
+ isWholeLine: true,
|
|
|
+ className: 'myContentClass',
|
|
|
+ glyphMarginClassName: 'myGlyphMarginClass'
|
|
|
+ }
|
|
|
+ }
|
|
|
+]);
|
|
|
|
|
|
-// You can now use `decorationId` to change or remove the decoration
|
|
|
+// You can now use `decorations` to change or remove the decoration
|
|
|
|
|
|
=======================HTML
|
|
|
<div id="container" style="height:100%;"></div>
|
|
@@ -389,28 +386,10 @@ var editor = monaco.editor.create(document.getElementById("container"), {
|
|
|
language: "javascript"
|
|
|
});
|
|
|
|
|
|
-var lineDecorationId = editor.changeDecorations(function(changeAccessor) {
|
|
|
- return changeAccessor.addDecoration({
|
|
|
- startLineNumber: 3,
|
|
|
- startColumn: 1,
|
|
|
- endLineNumber: 5,
|
|
|
- endColumn: 1
|
|
|
- }, {
|
|
|
- isWholeLine: true,
|
|
|
- linesDecorationsClassName: 'myLineDecoration'
|
|
|
- });
|
|
|
-});
|
|
|
-
|
|
|
-var inlineDecorationId = editor.changeDecorations(function(changeAccessor) {
|
|
|
- return changeAccessor.addDecoration({
|
|
|
- startLineNumber: 7,
|
|
|
- startColumn: 1,
|
|
|
- endLineNumber: 7,
|
|
|
- endColumn: 24
|
|
|
- }, {
|
|
|
- inlineClassName: 'myInlineDecoration'
|
|
|
- });
|
|
|
-});
|
|
|
+var decorations = editor.deltaDecorations([], [
|
|
|
+ { range: new monaco.Range(3,1,5,1), options: { isWholeLine: true, linesDecorationsClassName: 'myLineDecoration' }},
|
|
|
+ { range: new monaco.Range(7,1,7,24), options: { inlineClassName: 'myInlineDecoration' }},
|
|
|
+]);
|
|
|
|
|
|
=======================HTML
|
|
|
<div id="container" style="height:100%;"></div>
|
|
@@ -496,18 +475,16 @@ var editor = monaco.editor.create(document.getElementById("container"), {
|
|
|
nativeContextMenu: false
|
|
|
});
|
|
|
|
|
|
-var decorationId = editor.changeDecorations(function(changeAccessor) {
|
|
|
- return changeAccessor.addDecoration({
|
|
|
- startLineNumber: 3,
|
|
|
- startColumn: 1,
|
|
|
- endLineNumber: 3,
|
|
|
- endColumn: 1
|
|
|
- }, {
|
|
|
- isWholeLine: true,
|
|
|
- className: 'myContentClass',
|
|
|
- glyphMarginClassName: 'myGlyphMarginClass'
|
|
|
- });
|
|
|
-});
|
|
|
+var decorations = editor.deltaDecorations([], [
|
|
|
+ {
|
|
|
+ range: new monaco.Range(3,1,3,1),
|
|
|
+ options: {
|
|
|
+ isWholeLine: true,
|
|
|
+ className: 'myContentClass',
|
|
|
+ glyphMarginClassName: 'myGlyphMarginClass'
|
|
|
+ }
|
|
|
+ }
|
|
|
+]);
|
|
|
|
|
|
// Add a zone to make hit testing more interesting
|
|
|
var viewZoneId = null;
|