Implementing Argument-Passing in Handler Functions for React-Quill Module Configuration

44 Views Asked by At
 moudlues = {
    toolbar: {
      container: toolbarOptions,
      handlers: {
        link: () => this.openLinkDialog(quillRef),
      },
    },
  };

I'm having issue with passing a function with an argument to the modules handler in ReactQuill

I tried this way

getModules = (quillRef) => ({
    toolbar: {
      container: toolbarOptions,
      handlers: {
        link: () => this.openLinkDialog(quillRef),
      },
    },
  });
  renderEditor = (quillRef, onChangeHandler) => {
    const modules = this.getModules(quillRef);
    return (
  <ReactQuill
          ref={quillRef}
          modules={modules}
          onChange={onChangeHandler}
        />
      </div>
    );

I got this runtime error

Uncaught runtime errors:
×
ERROR
Cannot read properties of undefined (reading 'delta')
TypeError: Cannot read properties of undefined (reading 'delta')
    at ReactQuill.componentDidUpdate (http://localhost:3000/static/js/bundle.js:178758:20)
    at commitLayoutEffectOnFiber 
0

There are 0 best solutions below