Using Sun Editor in Next JS with CodeMirror

782 Views Asked by At

I am trying to use SunEditor in a NextJS app which I am able to with dynamic imports as below

const SunEditor = dynamic(() => import("suneditor-react"), {
  ssr: false,
});

Now the problem begins when I wish to use the codeMirror option in the Editor which turns out I need to import dynamically as well

const CodeMirror = dynamic(() => import("codemirror"), {
  ssr: false,
});

And after setting the codeMirror option correctly this error occurs

TypeError: options.codeMirror.src.fromTextArea is not a function

Has anyone been able to use it NextJS. Any help will be appreciated.

0

There are 0 best solutions below