Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: element with ID «editorjs» is missing. Pass correct holder's ID. #225

Open
Ivaneyko opened this issue Feb 8, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@Ivaneyko
Copy link

Ivaneyko commented Feb 8, 2023

Environment

  • @editorjs/editorjs version: 2.26.4
  • react-editor-js version: 2.1.0
  • react version: 18.2.0
  • react-dom version: 18.2.0

Code

const EditorInput = forwardRef<any, Props>(({
  label, id = '#', value, onChange, required, error, helperText, margin = 'normal',
  readOnly = false, minHeight = 32
}, ref) => {
  const instanceRef = useRef<any>(null);

  const handleInitialize = useCallback((instance:any) => {
    instanceRef.current = instance;
  }, []);

  const handleChange = async () => {
    const editorData = await instanceRef?.current?.save();

    if ( onChange ) onChange(editorData);
  }

  return (
     <ReactEditorJS
         tools={EDITOR_TOOLS}
         defaultValue={value}
         onInitialize={handleInitialize}
         onChange={handleChange}
         readOnly={readOnly}
         minHeight={minHeight}
         holder="editorjs"
     ><div id="editorjs" /></ReactEditorJS>
  )
});

Describe

Trying with and without custom holder.
This happens when you go to the page where it is editor located. When loading a page directly, this does not always happen

image

@Ivaneyko Ivaneyko added the bug Something isn't working label Feb 8, 2023
@Aldar0K
Copy link

Aldar0K commented Feb 10, 2023

I have the same problem

@steebchen
Copy link

This happens all the time with NextJS

@gediminastub
Copy link

This helps:
https://stackoverflow.com/questions/67688118/unhandled-rejection-error-element-with-id-editorjs-is-missing-pass-correct

@orbachar
Copy link

same issue here without SSR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants