A Vanilla Web Component to embed a Monaco code editor into a web page
npm i @vanillawc/wc-monaco-editor
This will create the wc-monaco-editor
folder in node_modules
.
<wc-monaco-editor language="markdown"></wc-monaco-editor>
Attributes
id
- the editor id (defaulteditor
)src
- load an external source filelanguage
- set the source languagestyle
- CSS styling (defaultheight:100%;width:100%;
)
Note: The ID attribute is required if there are multiple editors
Properties
value
- get/set the editor's contents
<wc-monaco-editor language="javascript" src="./assets/sample.js"></wc-monaco-editor>
Demo: WC-Monaco-Editor - Demo
The demo can also be run locally with
npm run start