Skip to content

Commit aa993e1

Browse files
committed
cleaner readme
1 parent b9b5c3e commit aa993e1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,10 @@ to be in the component tree.
155155

156156
```tsx
157157
// src/MyComponent.tsx
158-
import { useTipTapSync } from "@convex-dev/prosemirror-sync";
158+
import { useTipTapSync } from "@convex-dev/prosemirror-sync/tiptap";
159159
import { EditorContent, EditorProvider } from "@tiptap/react";
160160
import StarterKit from "@tiptap/starter-kit";
161-
162-
const extensions = [StarterKit];
163-
const EMPTY_DOC: JSONContent = { type: "doc", content: [] };
161+
import { api } from "../convex/_generated/api";
164162

165163
function MyComponent() {
166164
const sync = useTipTapSync(api.example, "some-id");
@@ -169,12 +167,14 @@ function MyComponent() {
169167
) : sync.initialContent !== null ? (
170168
<EditorProvider
171169
content={sync.initialContent}
172-
extensions={[...extensions, sync.extension]}
170+
extensions={[StarterKit, sync.extension]}
173171
>
174172
<EditorContent editor={null} />
175173
</EditorProvider>
176174
) : (
177-
<button onClick={() => sync.create(EMPTY_DOC)}>Create document</button>
175+
<button onClick={() => sync.create({ type: "doc", content: [] })}>
176+
Create document
177+
</button>
178178
);
179179
}
180180
```

0 commit comments

Comments
 (0)