Skip to content

Commit 0d7e496

Browse files
authored
fix(comments): update the styles for the cursor to be the default cursor (#2163)
1 parent 87f4ada commit 0d7e496

File tree

5 files changed

+23
-29
lines changed

5 files changed

+23
-29
lines changed

examples/07-collaboration/06-comments-with-sidebar/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@
2121
"@mantine/utils": "^6.0.22",
2222
"react": "^19.2.0",
2323
"react-dom": "^19.2.0",
24-
"@y-sweet/react": "^0.6.3"
24+
"y-partykit": "^0.0.25",
25+
"yjs": "^13.6.27"
2526
},
2627
"devDependencies": {
2728
"@types/react": "^19.2.2",
2829
"@types/react-dom": "^19.2.1",
2930
"@vitejs/plugin-react": "^4.7.0",
3031
"vite": "^5.4.20"
3132
}
32-
}
33+
}

examples/07-collaboration/06-comments-with-sidebar/src/App.tsx

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ import {
1212
ThreadsSidebar,
1313
useCreateBlockNote,
1414
} from "@blocknote/react";
15-
import { YDocProvider, useYDoc, useYjsProvider } from "@y-sweet/react";
1615
import { useMemo, useState } from "react";
16+
import YPartyKitProvider from "y-partykit/provider";
17+
import * as Y from "yjs";
1718

1819
import { SettingsSelect } from "./SettingsSelect";
1920
import { HARDCODED_USERS, MyUserType, getRandomColor } from "./userdata";
@@ -31,23 +32,19 @@ async function resolveUsers(userIds: string[]) {
3132
return HARDCODED_USERS.filter((user) => userIds.includes(user.id));
3233
}
3334

35+
// Sets up Yjs document and PartyKit Yjs provider.
36+
const doc = new Y.Doc();
37+
const provider = new YPartyKitProvider(
38+
"blocknote-dev.yousefed.partykit.dev",
39+
// Use a unique name as a "room" for your application.
40+
"comments-with-sidebar",
41+
doc,
42+
);
43+
3444
// This follows the Y-Sweet example to setup a collabotive editor
3545
// (but of course, you also use other collaboration providers
3646
// see the docs for more information)
3747
export default function App() {
38-
const docId = "my-blocknote-document-with-comments-2";
39-
40-
return (
41-
<YDocProvider
42-
docId={docId}
43-
authEndpoint="https://demos.y-sweet.dev/api/auth"
44-
>
45-
<Document />
46-
</YDocProvider>
47-
);
48-
}
49-
50-
function Document() {
5148
const [activeUser, setActiveUser] = useState<MyUserType>(HARDCODED_USERS[0]);
5249
const [commentFilter, setCommentFilter] = useState<
5350
"open" | "resolved" | "all"
@@ -56,11 +53,6 @@ function Document() {
5653
"position" | "recent-activity" | "oldest"
5754
>("position");
5855

59-
const provider = useYjsProvider();
60-
61-
// take the Y.Doc collaborative document from Y-Sweet
62-
const doc = useYDoc();
63-
6456
// setup the thread store which stores / and syncs thread / comment data
6557
const threadStore = useMemo(() => {
6658
// (alternative, use TiptapCollabProvider)

packages/core/src/comments/threadstore/yjs/YjsThreadStoreBase.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ export abstract class YjsThreadStoreBase extends ThreadStore {
2929
public getThreads(): Map<string, ThreadData> {
3030
const threadMap = new Map<string, ThreadData>();
3131
this.threadsYMap.forEach((yThread, id) => {
32-
threadMap.set(id, yMapToThread(yThread));
32+
if (yThread instanceof Y.Map) {
33+
threadMap.set(id, yMapToThread(yThread));
34+
}
3335
});
3436
return threadMap;
3537
}

packages/mantine/src/blocknoteStyles.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -635,10 +635,6 @@
635635
box-shadow: none;
636636
}
637637

638-
.bn-mantine .bn-thread:not(.selected) {
639-
cursor: pointer;
640-
}
641-
642638
.bn-mantine .bn-thread-comments,
643639
.bn-mantine .bn-thread-composer {
644640
display: flex;

pnpm-lock.yaml

Lines changed: 6 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)