score:7

Accepted answer

in order to access to quill editor, you have to create an ref to the <quill /> component, then use it to set the attribute. here is the snippet code:


// for typings
import quill from "react-quill";
import quilleditor from "quill"

export const contenteditor = ({ content, onchange }) => {
  const ref = react.useref<quill & { editor: quilleditor }>(null);

  // disable spellcheck as component is mounted
  react.useeffect(() => {
    ref.current?.editor.root.setattribute("spellcheck", "false");
  }, []);

  return (
    <quill
      // set the ref to access to quill editor
      ref={ref}
      theme="snow"
      value={content}
      onchange={onchange}
      modules={modules}
      formats={formats}
    />
  );
};

i have also made an sample as well: https://codesandbox.io/s/stoic-mendel-4g3jw?file=/src/app.js


Related Query

More Query from same tag