Closed ThinkDevStudios closed 2 years ago
@ThinkDevStudios Hit there!! Thanks a lot for report the issue. To use editorjs-drag-drop with react-editor-js, it is necessary to use the 'onInitialize' prop in the ReactEditorJS component to obtain the abstract editorjs, in your case you could implement:
........
.......
const OnboardingEditor = () => {
const editorCore = React.useRef(null)
const handleInitialize = React.useCallback((instance) => {
editorCore.current = instance
}, [])
const handleReady = () => {
const editor = editorCore.current._editorJS;
new Undo({ editor })
new DragDrop(editor);
};
const ReactEditorJS = createReactEditorJS()
return(
<ReactEditorJS
onInitialize={handleInitialize}
onReady = {handleReady}
tools={EDITOR_JS_TOOLS}
defaultValue={{
time: 1635603431943,
blocks: [
{
id: "sheNwCUP5A",
type: "header",
data: {
text: "Editor.js",
level: 2
}
},
...........................
..........................
]
}}
/>
)
}
We will update the Readme file with the support to react-editor-js. Thanks again.
Best, Mario
Description
I am getting this error. Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'configuration') Code works if I remove the OnReady. Where do i get the EditorJS. using React Editor JS uses createReactEditorJS()
Environment
Current behavior