code-edit
A custom element encapsulating a CodeMirror instance.
Install
npm install @bgoodman/code-edit
yarn add @bgoodman/code-edit
Usage
<script type="module" src="./dist/index.js"></script>
<code-edit></code-edit>
Attributes
mode
Specify code type using a language mode. Options include:
"htmlmixed"
- default (html/css/js)"javascript"
"typescript"
"markdown"
Methods
Get the current editor content. You can pass it an optional argument to specify the string to be used to separate lines (defaults to "\n").
getValue(seperator?: string): Promise<string>
Set the editor content.
setValue(code: string): Promise<void>