-
-
Notifications
You must be signed in to change notification settings - Fork 597
Closed
Description
Related to #214, following code does not work.
Editor.ts
import { useEffect } from "react";
import {
BlockNoteView,
useBlockNote,
} from "@blocknote/react";
import "@blocknote/core/style.css";
type Props = {
editable: boolean;
}
export default Editor({ editable }: Props) {
const editor = useBlockNote({
editable
});
// Test Code
useEffect(() => {
console.log(editor?.isEditable);
}, [editable]);
return <BlockNoteView editor={editor} />;
}
main.ts
import { useState } from "react";
import Editor from './Editor.ts';
export default Main() {
const [editable, setEditable] = useState(true);
return (
<div>
<button onClick={() => setEditable(!editable)}>Toggle Editable</button>
<Editor editable={editable} />
</div>
);
}
How can I make this work?
Metadata
Metadata
Assignees
Labels
No labels