react中使用富文本react-quill

1.安装富文本编辑器:npm i react-quill

2.页面中引入

import ReactQuill from react-quill ;

import quill/dist/quill.snow.css ;

3.自定义配置

  const modules = {

    toolbar: {

      container: [

        [{ header: [1, 2, 3, 4, 5, 6, false] }],

        [ bold , italic , underline , strike ],

        [{ list: ordered }, { list: bullet }],

        [{ align: [] }],

        [{ color: [] }, { background: [] }],

        [ link , image ],

        [ clean ],

      ],

      //如果不自定义上传下面的可以不要

      handlers: {

        image() {

          imageHandler.call(this, props.action);

        },

      },

    },

  };

  const options = {

    modules: modules,

    ref: refs,

  }

4.页面中使用,可自定义图片上传

react中使用富文本react-quill

5.自定义图片上传

react中使用富文本react-quill

© 版权声明

相关文章

暂无评论

您必须登录才能参与评论!
立即登录
none
暂无评论...