-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3595 from microsoft/hediet/blonde-puma
Fixes #3588
- Loading branch information
Showing
4 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
8 changes: 8 additions & 0 deletions
8
website/src/website/data/playground-samples/creating-the-editor/web-component/sample.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<template id="editor-template"> | ||
<div | ||
id="container" | ||
style="overflow: hidden; width: 100%; height: 100%; position: absolute" | ||
></div> | ||
</template> | ||
|
||
<code-view-monaco></code-view-monaco> |
33 changes: 33 additions & 0 deletions
33
website/src/website/data/playground-samples/creating-the-editor/web-component/sample.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
customElements.define( | ||
"code-view-monaco", | ||
class CodeViewMonaco extends HTMLElement { | ||
_monacoEditor; | ||
/** @type HTMLElement */ | ||
_editor; | ||
|
||
constructor() { | ||
super(); | ||
|
||
const shadowRoot = this.attachShadow({ mode: "open" }); | ||
|
||
// Copy over editor styles | ||
const style = document.querySelector( | ||
"link[rel='stylesheet'][data-name='vs/editor/editor.main']" | ||
); | ||
shadowRoot.appendChild(style.cloneNode(true)); | ||
|
||
const template = /** @type HTMLTemplateElement */ ( | ||
document.getElementById("editor-template") | ||
); | ||
shadowRoot.appendChild(template.content.cloneNode(true)); | ||
|
||
this._editor = shadowRoot.querySelector("#container"); | ||
this._monacoEditor = monaco.editor.create(this._editor, { | ||
automaticLayout: true, | ||
language: "html", | ||
|
||
value: `<div>Hello World</div>`, | ||
}); | ||
} | ||
} | ||
); |
4 changes: 4 additions & 0 deletions
4
website/src/website/data/playground-samples/creating-the-editor/web-component/sample.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"title": "Web Component", | ||
"sortingKey": 10000 | ||
} |