瀏覽代碼

Merge pull request #3775 from PmcFizz/main

use createDecorationsCollection replace deltaDecorations
Henning Dieterichs 2 年之前
父節點
當前提交
7374280f4e

+ 12 - 15
website/src/website/data/playground-samples/interacting-with-the-editor/line-and-inline-decorations/sample.js

@@ -15,19 +15,16 @@ var editor = monaco.editor.create(document.getElementById("container"), {
 	language: "javascript",
 });
 
-var decorations = editor.deltaDecorations(
-	[],
-	[
-		{
-			range: new monaco.Range(3, 1, 5, 1),
-			options: {
-				isWholeLine: true,
-				linesDecorationsClassName: "myLineDecoration",
-			},
+var decorations = editor.createDecorationsCollection([
+	{
+		range: new monaco.Range(3, 1, 5, 1),
+		options: {
+			isWholeLine: true,
+			linesDecorationsClassName: "myLineDecoration",
 		},
-		{
-			range: new monaco.Range(7, 1, 7, 24),
-			options: { inlineClassName: "myInlineDecoration" },
-		},
-	]
-);
+	},
+	{
+		range: new monaco.Range(7, 1, 7, 24),
+		options: { inlineClassName: "myInlineDecoration" },
+	},
+]);

+ 9 - 12
website/src/website/data/playground-samples/interacting-with-the-editor/listening-to-mouse-events/sample.js

@@ -17,19 +17,16 @@ var editor = monaco.editor.create(document.getElementById("container"), {
 	contextmenu: false,
 });
 
-var decorations = editor.deltaDecorations(
-	[],
-	[
-		{
-			range: new monaco.Range(3, 1, 3, 1),
-			options: {
-				isWholeLine: true,
-				className: "myContentClass",
-				glyphMarginClassName: "myGlyphMarginClass",
-			},
+var decorations = editor.createDecorationsCollection([
+	{
+		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;

+ 9 - 12
website/src/website/data/playground-samples/interacting-with-the-editor/rendering-glyphs-in-the-margin/sample.js

@@ -16,18 +16,15 @@ var editor = monaco.editor.create(document.getElementById("container"), {
 	glyphMargin: true,
 });
 
-var decorations = editor.deltaDecorations(
-	[],
-	[
-		{
-			range: new monaco.Range(3, 1, 3, 1),
-			options: {
-				isWholeLine: true,
-				className: "myContentClass",
-				glyphMarginClassName: "myGlyphMarginClass",
-			},
+var decorations = editor.createDecorationsCollection([
+	{
+		range: new monaco.Range(3, 1, 3, 1),
+		options: {
+			isWholeLine: true,
+			className: "myContentClass",
+			glyphMarginClassName: "myGlyphMarginClass",
 		},
-	]
-);
+	},
+]);
 
 // You can now use `decorations` to change or remove the decoration