Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions docs/pages/api-reference/liveblocks-react-blocknote.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1025,31 +1025,33 @@ function Threads({ editor }: { editor: BlockNoteEditor }) {
// +++
```

Here’s how it can be used in the context of your editor.
### useIsEditorReady

Used to check if the editor content has been loaded or not, helpful for
displaying a loading skeleton.

```ts
import { useIsEditorReady } from "@liveblocks/react-blocknote";

const status = useIsEditorReady();
```

Here's how it can be used in the context of your editor.

```tsx
import { useLiveblocksExtension } from "@liveblocks/react-tiptap";
// +++
import { useIsEditorReady, useEditor, EditorContent } from "@tiptap/react";
// +++
import { useCreateBlockNoteWithLiveblocks, useIsEditorReady } from "@liveblocks/react-blocknote";
import { BlockNoteView } from "@blocknote/mantine";

function TextEditor() {
const liveblocks = useLiveblocksExtension();
const editor = useCreateBlockNoteWithLiveblocks({});
// +++
const ready = useIsEditorReady();
// +++

const editor = useEditor({
extensions: [
liveblocks,
// ...
],
});

return (
<div>
// +++
{!ready ? <div>Loading...</div> : <EditorContent editor={editor} />}
{!ready ? <div>Loading...</div> : <BlockNoteView editor={editor} />}
// +++
</div>
);
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/api-reference/liveblocks-react-tiptap.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2282,9 +2282,9 @@ const status = useIsEditorReady();
Here’s how it can be used in the context of your editor.

```tsx
import { useLiveblocksExtension } from "@liveblocks/react-tiptap";
// +++
import { useIsEditorReady, useEditor, EditorContent } from "@tiptap/react";
import { useIsEditorReady, useLiveblocksExtension } from "@liveblocks/react-tiptap";
import { useEditor, EditorContent } from "@tiptap/react";
// +++

function TextEditor() {
Expand Down
Loading