verbum icon indicating copy to clipboard operation
verbum copied to clipboard

In next.js 13, Error: Unable to find an active editor state

Open maccomaccomaccomacco opened this issue 1 year ago • 3 comments

Describe the bug Trying to use Verbum in a Next.js project, I get the following error

Unhandled Runtime Error
Error: Unable to find an active editor state. State helpers or node methods can only be used synchronously during the callback of editor.update() or editorState.read().

To Reproduce Steps to reproduce the behavior:

  1. create a next.js 13 project
  2. define a component with the following code
'use client'

import {
    EditorComposer,
    Editor,
    ToolbarPlugin,
    AlignDropdown,
    InsertDropdown,
  } from 'verbum';
  
  const Verbum = () => {
    return (
      
    <EditorComposer>
        <Editor hashtagsEnables={true}>
        <ToolbarPlugin defaultFontSize="20px">
            <InsertDropdown enablePool={true} />
            <AlignDropdown />
        </ToolbarPlugin>
        </Editor>
    </EditorComposer>
    );
  };
  
  export default Verbum;
  1. import the component into src/app/page.jsx
  2. run the next.js application yarn run dev
  3. you'll get the error

Expected behavior No error in next.js and Lexical editor rendered

Screenshots image

Desktop (please complete the following information):

  • OS: MacOS moneterey 12.2.1
  • chrome

maccomaccomaccomacco avatar Apr 07 '23 21:04 maccomaccomaccomacco

Describe the bug Trying to use Verbum in a Next.js project, I get the following error

Unhandled Runtime Error
Error: Unable to find an active editor state. State helpers or node methods can only be used synchronously during the callback of editor.update() or editorState.read().

To Reproduce Steps to reproduce the behavior:

  1. create a next.js 13 project
  2. define a component with the following code
'use client'

import {
    EditorComposer,
    Editor,
    ToolbarPlugin,
    AlignDropdown,
    InsertDropdown,
  } from 'verbum';
  
  const Verbum = () => {
    return (
      
    <EditorComposer>
        <Editor hashtagsEnables={true}>
        <ToolbarPlugin defaultFontSize="20px">
            <InsertDropdown enablePool={true} />
            <AlignDropdown />
        </ToolbarPlugin>
        </Editor>
    </EditorComposer>
    );
  };
  
  export default Verbum;
  1. import the component into src/app/page.jsx
  2. run the next.js application yarn run dev
  3. you'll get the error

Expected behavior No error in next.js and Lexical editor rendered

Screenshots image

Desktop (please complete the following information):

  • OS: MacOS moneterey 12.2.1
  • chrome

I have same problem

reza-madani avatar Oct 02 '23 16:10 reza-madani

Facing the same issue. Any solution?

geekyayush avatar Dec 14 '23 09:12 geekyayush

@marcoautiero @reza-madani were you able to solve this?

geekyayush avatar Dec 14 '23 10:12 geekyayush