Browse Source

Merge pull request #3879 from microsoft/hediet/webcomponent-bugfix

Fixes webcomponent sample for local development
Henning Dieterichs 2 years ago
parent
commit
1c6f48aa7d

+ 2 - 0
website/scripts/check-playground-samples-js.ts

@@ -14,6 +14,8 @@ import { exit } from "process";
 					"yarn",
 					"yarn",
 					[
 					[
 						"tsc",
 						"tsc",
+						"--target",
+						"es6",
 						"--noEmit",
 						"--noEmit",
 						"--allowJs",
 						"--allowJs",
 						"--checkJs",
 						"--checkJs",

+ 5 - 3
website/src/website/data/playground-samples/creating-the-editor/web-component/sample.js

@@ -11,10 +11,12 @@ customElements.define(
 			const shadowRoot = this.attachShadow({ mode: "open" });
 			const shadowRoot = this.attachShadow({ mode: "open" });
 
 
 			// Copy over editor styles
 			// Copy over editor styles
-			const style = document.querySelector(
-				"link[rel='stylesheet'][data-name='vs/editor/editor.main']"
+			const styles = document.querySelectorAll(
+				"link[rel='stylesheet'][data-name^='vs/']"
 			);
 			);
-			shadowRoot.appendChild(style.cloneNode(true));
+			for (const style of styles) {
+				shadowRoot.appendChild(style.cloneNode(true));
+			}
 
 
 			const template = /** @type HTMLTemplateElement */ (
 			const template = /** @type HTMLTemplateElement */ (
 				document.getElementById("editor-template")
 				document.getElementById("editor-template")