1.1.0 • Published 5 years ago
gtl-editor v1.1.0
gtl-editor
Based on monaco-editor and React.
Usage
- install
# npm
npm install gtl-language gtl-editor
# yarn
yarn add gtl-language gtl-editor
- example
import React, { useState } from 'react';
import CodeEditor from 'gtl-editor'
import { Tree, Program } from 'gtl-language'
function App() {
const onCodeChange = (code: string, tree: Tree, program: Program) => {
console.log({
code,
tree,
program
})
setProgram(program)
setTree(tree)
}
return (
<CodeEditor onSave={onCodeChange} />
)
}
Note
You must add monaco-editor-webpack-plugin before use it.