Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/moroboxai/moroboxai-editor-web

Embeddable code editor for coding AIs for MoroboxAI on the web
https://github.com/moroboxai/moroboxai-editor-web

code-editor javascript library moroboxai typescript

Last synced: about 2 months ago
JSON representation

Embeddable code editor for coding AIs for MoroboxAI on the web

Awesome Lists containing this project

README

        

# moroboxai-editor-web

[![NPM version](https://img.shields.io/npm/v/moroboxai-editor-web.svg)](https://www.npmjs.com/package/moroboxai-editor-web)
![Node.js CI](https://github.com/moroboxai/moroboxai-editor-web/workflows/Node.js%20CI/badge.svg)
[![gitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/moroboxai/moroboxai-editor-web/blob/master/LICENSE)
[![Code Quality: Javascript](https://img.shields.io/lgtm/grade/javascript/g/moroboxai/moroboxai-editor-web.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/moroboxai/moroboxai-editor-web/context:javascript)
[![Total Alerts](https://img.shields.io/lgtm/alerts/g/moroboxai/moroboxai-editor-web.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/moroboxai/moroboxai-editor-web/alerts)

Embeddable code editor for coding AIs for [MoroboxAI](https://github.com/moroboxai) on the web.

## Install

Using npm:

```bash
npm install moroboxai-editor-web --save
```

Or:

```bash
git clone https://github.com/moroboxai/moroboxai-editor-web.git
cd moroboxai-editor-web
npm i
npm run build
```

## Usage

Create a `sample.html` file in the `moroboxai-editor-web` folder:

```html





// Initialize the editor on our div
const editor = MoroboxAIEditor.init({
element: document.getElementById("editor"),
value: 'function foo() {\n console.log("foo");\n}\n',
width: "500px",
height: "400px"
});

```

Open `sample.html` in your browser and check the console output.

## Arguments

| Name | Type | Default | Description |
|:----------|:-------------|:------|:------|
| element | Element || DOM element to attach the editor to |
| language | string | javascript | Selected language |
| value | string || Initial content of the editor |
| width | string || Width of the `div` element |
| height | string || Height of the `div` element |
| onLoad | func | noop | **Signature: function(value: string) => void**
Function called when the Load button is clicked |
| onUnload | func | noop | **Signature: function() => void**
Function called when the Unload button is clicked |

## License

This content is released under the [MIT](http://opensource.org/licenses/MIT) License.