Skip to content

Commit ff05643

Browse files
committed
fixes
1 parent fc55b0f commit ff05643

2 files changed

Lines changed: 15 additions & 16 deletions

File tree

packages/docs/content/docs/collab/quick-start.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,7 @@ This client uses the endpoints you created above to send and listen for commits.
116116
// The LongPollListener listens for document changes at the GET
117117
// endpoint `/api/docs/:docId/commits` you created above
118118
const longPollListner = new LongPollListener(
119-
new URL(
120-
`/api/docs/${doc.id}/commits`,
121-
typeof window !== "undefined" ? window.location.href : "http://localhost:3000",
122-
),
119+
new URL(`/api/docs/${doc.id}/commits`, "http://localhost:3000"),
123120
);
124121

125122
const collabClient = new CollabClient({

packages/docs/content/docs/presence/reference/quick-start renamed to packages/docs/content/docs/presence/reference/quick-start.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ explanation, see the [Presence Guide](https://pitter-patter.dev/docs/guides/pres
1212
npm i @pitter-patter/presence-server
1313
```
1414

15-
First create a [PresenceAuthority](https://pitter-patter.dev/docs/presence/reference/presence-server/classes/PresenceAuthority). The code below assumes you have a Redis cluster accessible at `REDIS_URL`
15+
First create a
16+
[PresenceAuthority](https://pitter-patter.dev/docs/presence/reference/presence-server/classes/PresenceAuthority).
17+
The code below assumes you have a Redis cluster accessible at `REDIS_URL`
1618

1719
```ts
1820
import {
@@ -36,8 +38,8 @@ const presenceAuthority = new PresenceAuthority({
3638
});
3739
```
3840

39-
Next, create two endpoints. One for clients to submit their presence indicator and one for
40-
clients to listen for updated presence indicators.
41+
Next, create two endpoints. One for clients to submit their presence indicator and one for clients
42+
to listen for updated presence indicators.
4143

4244
```ts
4345
// Endpoint that clients will use to send their updated indicator to the PresenceAuthority
@@ -61,15 +63,14 @@ app.post("/api/docs/:docId/presence", async (req, res) => {
6163
});
6264
```
6365

64-
6566
## Configure your frontend
6667

6768
```npm
6869
npm i @pitter-patter/presence-client
6970
```
7071

71-
To configure your frontend editor with Presence, you first add the presence plugin when creating your
72-
editor state
72+
To configure your frontend editor with Presence, you first add the presence plugin when creating
73+
your editor state
7374

7475
```ts
7576
import { EditorState } from "prosemirror-state";
@@ -95,10 +96,7 @@ This client uses the endpoints you created above to send and listen for indicato
9596
// The PresenceListener listens for indicator changes at the
9697
// `/api/docs/:docId/presence` endpoint you created above
9798
const presenceListener = new PresenceListener(
98-
new URL(
99-
`/api/docs/${doc.id}/presence`,
100-
typeof window !== "undefined" ? window.location.href : "http://localhost:3000",
101-
),
99+
new URL(`/api/docs/${doc.id}/presence`, "http://localhost:3000"),
102100
);
103101

104102
const presenceClient = new PresenceClient({
@@ -114,13 +112,17 @@ const presenceClient = new PresenceClient({
114112
});
115113
```
116114

117-
Tell the [PresenceClient](https://pitter-patter.dev/docs/presence/reference/presence-client/classes/PresenceClient) to listen for updates
115+
Tell the
116+
[PresenceClient](https://pitter-patter.dev/docs/presence/reference/presence-client/classes/PresenceClient)
117+
to listen for updates
118+
118119
```ts
119120
const abortController = new AbortController();
120121
presenceClient.listen(abortController.signal).catch((e) => console.error(e));
121122
```
122123

123124
And send your client's indicator state when it updates
125+
124126
```ts
125127
presenceClient.send(state).catch((e) => console.error(e));
126-
```
128+
```

0 commit comments

Comments
 (0)