react-quill-antd

1.0.1-beta • Public • Published

the Quill rich text editor in antd.

Instruction

just test, There are a lot of bugs. Welcome you to fix them.

SnapShot

image

Development

just run npm run start

Build

Usage

Install

$ npm i react-quill-antd -S

1. Used without antd form

import React from 'react';
import Editor from 'react-quill-antd';
import 'react-quill-antd/dist/index.css';
 
export default class Test extends React.Component {
  state = {
    content: '',
  }
  handleChange = content => {
    this.setState({ content });
  }
  render() {
    return (
      <div>
        <Editor
          value={this.state.content}
          onChange={this.handleChange}
          placeholder="please input ..."
        />
      </div>
    )
  }
}
 

2. Used with antd Form

online Codesandbox

import Editor from 'react-quill-antd';
import 'react-quill-antd/dist/index.css';
 
class EditorForm extends React.Component {
  componentDidMount() {
    // To disabled submit button at the beginning.
    this.props.form.validateFields();
  }
 
  handleSubmit = e => {
    e.preventDefault();
    this.props.form.validateFields((err, values) => {
      if (!err) {
        console.log("Received values of form: ", values);
      }
    });
  };
 
  render() {
    const { getFieldDecorator } = this.props.form;
 
    return (
      <Form layout="inline" onSubmit={this.handleSubmit}>
        <FormItem>
          {getFieldDecorator("content", {
            initialValue: "<p>Hello World</p>"
          })(<Editor />)}
        </FormItem>
        <FormItem>
          <Button type="primary" htmlType="submit">
            Submit
          </Button>
        </FormItem>
      </Form>
    );
  }
}

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.1-beta
    35
    • latest

Version History

Package Sidebar

Install

npm i react-quill-antd

Weekly Downloads

37

Version

1.0.1-beta

License

none

Unpacked Size

1.24 MB

Total Files

12

Last publish

Collaborators

  • ycjcl868