相关文章推荐
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams
const App = ({ }) => {
    const [message, setMessage] = React.useState('')
    ReactQuill.Quill.import('modules/matchers')
    ReactQuill.Quill.register("imageResize", ImageResize)
    const modules = {
        toolbar: [
            [{ header: '1' }, { header: '2' }, { font: [] }],
            //[{ size: [] }],
            ['bold', 'italic', 'underline', 'strike', 'link'],
            [{ 'color': [] }, { 'background': [] }], 
            //[{ 'font': [] }],
            [{ 'align': [] }],
            ['blockquote', 'code-block'],
            ['image'],
                { list: 'ordered' },
                { list: 'bullet' },
                { indent: '-1' },
                { indent: '+1' }
            ['clean']
        clipboard: {
            matchVisual: false,
            matchers: [
                ['span', preserveSizeFormat]
        imageResize: {
            parchment: ReactQuill.Quill.import('parchment'),
            modules : ['Resize', 'DisplaySize']
        mention: {
            allowedChars: /^[A-Za-z\sÅÄÖåäö]*$/,
            mentionDenotationChars: ["@", "#"],
            source: function (searchTerm, renderList, mentionChar) {
                console.log('mention',searchTerm, renderList, mentionChar)
    const preserveSizeFormat = (node, delta) => {
        console.log('node',node,'delta',delta)
    return <ReactQuill value={message} onChange={(html) => { console.log('html',html); setMessage(html) }} placeholder={''} modules={modules}  />

I'm trying to add mention, image resize and clipboard matcher but it doesn't work when I try to import or register.

I have this errors :

Someone have any idea to make it works ?

I have the version 1.3.3 of react-quill

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.

 
推荐文章