acklen-keystone
Version:
Web Application Framework and Admin GUI / Content Management System built on Express.js and Mongoose
47 lines (43 loc) • 1.1 kB
JavaScript
import React, { Component } from 'react';
import ReactQuill from 'react-quill';
import 'react-quill/dist/quill.snow.css';
import 'react-quill/dist/quill.bubble.css';
import 'react-quill/dist/quill.core.css';
import '../../style/UI-Component/editor/quill.snow.css';
export default class Editor extends Component {
constructor (props) {
super(props);
this.handleChange = this.handleChange.bind(this);
this.state = { value: '' };
this.quillModules = {
toolbar: {
container: [
[{ header: [1, 2, false] }, { font: [] }],
['bold', 'italic', 'underline', 'strike', 'blockquote'],
[
{ list: 'ordered' },
{ list: 'bullet' },
{ indent: '-1' },
{ indent: '+1' },
],
['link', 'image', 'video'],
['clean'],
],
},
};
}
handleChange (value) {
this.setState({ value });
}
render () {
const options = {
theme: 'snow',
formats: Editor.formats,
placeholder: 'Write Something',
value: this.state.value,
onChange: this.handleChange,
modules: this.quillModules,
};
return <ReactQuill {...options} />;
}
}