Skip to content

Commit

Permalink
fix: Minor collaboration cursor & docs changes (#1381)
Browse files Browse the repository at this point in the history
* Small collaboration cursor fixes

* Slight edit to dot and label height offsets

* Small fix

* - Updated collaboration docs with `showCursorLabels` option
- Changed `all-blocks` example to `default-blocks`
  • Loading branch information
matthewlipski authored Jan 20, 2025
1 parent 800a1f0 commit f4e7732
Show file tree
Hide file tree
Showing 15 changed files with 24 additions and 23 deletions.
5 changes: 5 additions & 0 deletions docs/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ const nextConfig = withAnalyzer(
destination: "/docs/advanced/vanilla-js",
permanent: true,
},
{
source: "/examples/basic/all-blocks",
destination: "/examples/basic/default-blocks",
permanent: true,
},
],
experimental: {
externalDir: true,
Expand Down
3 changes: 3 additions & 0 deletions docs/pages/docs/advanced/real-time-collaboration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ const editor = useCreateBlockNote({
name: "My Username",
color: "#ff0000",
},
// When to show user labels on the collaboration cursor. Set by default to
// "activity" (show when the cursor moves), but can also be set to "always".
showCursorLabels: "activity"
},
// ...
});
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/docs/editor-basics/default-schema.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ BlockNote supports a number of built-in blocks, inline content types, and styles

The demo below showcases each of BlockNote's built-in block and inline content types:

<Example name="basic/all-blocks" />
<Example name="basic/default-blocks" />

## Default Blocks

Expand Down
9 changes: 0 additions & 9 deletions examples/01-basic/04-all-blocks/.bnexample.json

This file was deleted.

6 changes: 6 additions & 0 deletions examples/01-basic/04-default-blocks/.bnexample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"playground": true,
"docs": true,
"author": "yousefed",
"tags": ["Basic", "Blocks", "Inline Content"]
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@blocknote/example-all-blocks",
"name": "@blocknote/example-default-blocks",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
Expand All @@ -17,8 +17,7 @@
"@blocknote/mantine": "latest",
"@blocknote/shadcn": "latest",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"@blocknote/xl-multi-column": "latest"
"react-dom": "^18.3.1"
},
"devDependencies": {
"@types/react": "^18.0.25",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/editor/BlockNoteExtensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ const getTipTapExtensions = <

cursorElement.classList.add("collaboration-cursor__caret");
cursorElement.setAttribute("style", `border-color: ${color}`);
if (opts.collaboration?.showCursorLabels !== "always") {
if (opts.collaboration?.showCursorLabels === "always") {
cursorElement.setAttribute("data-active", "");
}

Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/editor/editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Tippy popups that are appended to document.body directly
max-height: 4px;
max-width: 4px;
padding: 0;
transform: translateY(3px);
top: 0;

transition: all 0.2s;

Expand All @@ -115,7 +115,7 @@ Tippy popups that are appended to document.body directly
max-height: 1.1rem;
max-width: 20rem;
padding: 0.1rem 0.3rem;
transform: translateY(-14px);
top: -14px;

transition: all 0.2s;
}
Expand Down
11 changes: 4 additions & 7 deletions playground/src/examples.gen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@
}
},
{
"projectSlug": "all-blocks",
"fullSlug": "basic/all-blocks",
"pathFromRoot": "examples/01-basic/04-all-blocks",
"projectSlug": "default-blocks",
"fullSlug": "basic/default-blocks",
"pathFromRoot": "examples/01-basic/04-default-blocks",
"config": {
"playground": true,
"docs": true,
Expand All @@ -76,10 +76,7 @@
"Basic",
"Blocks",
"Inline Content"
],
"dependencies": {
"@blocknote/xl-multi-column": "latest"
} as any
]
},
"title": "Default Schema Showcase",
"group": {
Expand Down

0 comments on commit f4e7732

Please sign in to comment.