1.1.0 • Published 5 years ago

gtl-editor v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

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.

1.1.0

5 years ago

1.0.0

5 years ago

1.0.0-alpha.0

5 years ago