0.1.4 • Published 5 years ago

@lilonga/live-editor v0.1.4

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

@lilonga/live-editor

Modular live-coding environment for React

NPM

Demo

[Demo]

@lilonga/live-editor demo on Repl.it

Install

npm install --save @lilonga/live-editor

Usage

import React, { Component } from "react";

import LiveEditor from "@lilonga/live-editor";
import OutputIframe from "@lilonga/output-iframe";
import "brace/mode/html";

let iframeCode = `
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8"/>
	<title>A title</title>
</head>
<body>
	Hello world
</body>
</html>

`;

class App extends Component {
	constructor(){
		super()
		this.state = {
			input:iframeCode,
		}
	}
	render() {
		return (

			<div>
				<LiveEditor
					input={this.state.input}
					onInputChange={(input) => {
						this.setState({input})
					}}
					editorProps={{
						mode:'html'
					}}
					width={"100%"}
					height={"400px"}
					outputComponent={OutputIframe}
					outputProps={{

					}}
				/>
			
			</div>
		);
	}
}

export default App;

License

MIT © lilonga

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago