@saber2pr/monaco
v0.0.90
Published
monaco.
Downloads
103
Readme
@saber2pr/monaco
monaco
yarn add @saber2pr/monaco
Usage
editor:
import { createEditor } from '@saber2pr/monaco'
// 1. create editor
const editor = await createEditor(
dom,
{
// file: file-content
'input.jsx': "const a = 'hello';",
'input.css': '#root { color: red; }',
},
{ theme: 'vs-dark' }
)
// get current modal value
editor.getValue()
// set value to current modal
editor.setValue('code')
// change current modal
editor.changeModel('input.css')
// get modal
editor.getModel('input.jsx').onDidChangeContent
diffEditor:
import { createDiffEditor } from '@saber2pr/monaco'
// container, oldText, newText, language
createDiffEditor(dom, '{"name": "app"}', '{"name": "subApp"}', 'json')