1.2.1 • Published 7 years ago

preact-richtextarea v1.2.1

Weekly downloads
70
License
MIT
Repository
github
Last release
7 years ago

preact-richtextarea

NPM travis-ci

A <textarea> that supports HTML editing, powered by Preact & contentEditable.


Usage Example

Use <RichTextArea /> like a normal <input>. It supports the same props/attributes, including value, onInput() and onChange().

import RichTextArea from 'preact-richtextarea';

const HtmlEditor = ({ html, ...props }) => (
	<label class="html">
		Body HTML:
		<RichTextArea value={html} {...props} />
	</form>
);

let html = `<h1>hello</h1><p>Testing 1 2 3...</p>`;
render(<HtmlEditor html={html} />, document.body);

Usage with Linked State

<RichTextArea /> works with Linked State exactly the same way as any other input field:

import RichTextArea from 'preact-richtextarea';

class Form extends Component {
	render({ }, { html }) {
		return (
			<form>
				<RichTextArea value={html} onChange={ this.linkState('html') } />
			</form>
		);
	}
}

render(<Form />, document.body);

License

MIT

1.2.1

7 years ago

1.2.0

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

8 years ago

1.0.0

8 years ago

0.1.0

8 years ago