-
- Notifications
You must be signed in to change notification settings - Fork 625
Description
Describe the bug
Says window is not defined out of box. Adding additional capacity such as only load editor when window is defined causes hydration issues or "Cannot read properties of undefined (reading 'parentElement')"
To Reproduce
try to compile
`
import { BlockNoteView, useBlockNote } from "@blocknote/react";
import "@blocknote/core/style.css";
function Notion({}) {
const editor = useBlockNote({
onEditorContentChange: (editor) => {
// Log the document to console on every update
console.log(editor.getJSON());
},
});
return ();
`
Misc
ReferenceError: window is not defined
at Object.generateID (file:///.../node_modules/@blocknote/core/dist/blocknote.js:560:25)
const U = T.create({
name: "uniqueID",
// we’ll set a very high priority to make sure this runs first
// and is compatible with appendTransaction hooks of other extensions
priority: 1e4,
addOptions() {
return {
attributeName: "id",
types: [],
generateID: () => window.__TEST_OPTIONS ? (window.__TEST_OPTIONS.mockID === void 0 ? window.__TEST_OPTIONS.mockID = 0 : window.__TEST_OPTIONS.mockID++, window.__TEST_OPTIONS.mockID.toString()) : ne(),
filterTransaction: null
};
},