Embeddable code editor for coding AIs for MoroboxAI on the web.
Using npm:
npm install moroboxai-editor-web --save
Or:
git clone https://github.com/moroboxai/moroboxai-editor-web.git
cd moroboxai-editor-web
npm i
npm run build
Create a sample.html
file in the moroboxai-editor-web
folder:
<html>
<div id="editor"></div>
<script type="text/javascript" src="./lib/umd/moroboxai-editor-web.js"></script>
<script type="text/javascript">
// 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"
});
</script>
</html>
Open sample.html
in your browser and check the console output.
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 |
This content is released under the MIT License.