Skip to content

Commit 3f83c75

Browse files
committed
Merge branch 'main' into default-blocks
2 parents 4b9d5d0 + c3422c2 commit 3f83c75

File tree

78 files changed

+1065
-1340
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+1065
-1340
lines changed

docs/app/pricing/tiers.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { CheckIcon } from "@heroicons/react/20/solid";
44
import { track } from "@vercel/analytics";
55
import classNames from "classnames";
66
import React from "react";
7+
import * as Sentry from "@sentry/nextjs";
78

89
type Frequency = "month" | "year";
910

@@ -76,7 +77,14 @@ function TierCTAButton({ tier }: { tier: Tier }) {
7677
}
7778

7879
if (session.planType === "free") {
79-
track("Signup", { tier: tier.id });
80+
Sentry.captureEvent({
81+
message: "Checkout",
82+
level: "info",
83+
extra: {
84+
tier: tier.id,
85+
},
86+
});
87+
track("Checkout", { tier: tier.id });
8088
e.preventDefault();
8189
e.stopPropagation();
8290
await authClient.checkout({

docs/components/AuthenticationPage.tsx

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import {
99
useEffect,
1010
useState,
1111
} from "react";
12+
import { track } from "@vercel/analytics";
13+
import * as Sentry from "@sentry/nextjs";
1214

1315
import ThemedImage from "@/components/ThemedImage";
1416
import blockNoteLogo from "@/public/img/logos/banner.svg";
@@ -69,6 +71,14 @@ function AuthenticationBox(props: {
6971
setSigningInState({ state: "loading" });
7072

7173
if (props.variant === "password") {
74+
track("Sign In", { type: "password" });
75+
Sentry.captureEvent({
76+
message: "Sign In",
77+
level: "info",
78+
extra: {
79+
type: "password",
80+
},
81+
});
7282
await signIn.email(
7383
{
7484
email,
@@ -88,6 +98,14 @@ function AuthenticationBox(props: {
8898
},
8999
);
90100
} else if (props.variant === "email") {
101+
track("Sign In", { type: "magic-link" });
102+
Sentry.captureEvent({
103+
message: "Sign In",
104+
level: "info",
105+
extra: {
106+
type: "magic-link",
107+
},
108+
});
91109
await signIn.magicLink(
92110
{
93111
email,
@@ -117,6 +135,14 @@ function AuthenticationBox(props: {
117135
},
118136
);
119137
} else {
138+
track("Create Account");
139+
Sentry.captureEvent({
140+
message: "Sign Up",
141+
level: "info",
142+
extra: {
143+
type: "email",
144+
},
145+
});
120146
await signUp.email(
121147
{
122148
email,
@@ -318,12 +344,20 @@ function GitHubSignInButton() {
318344
/>
319345
</svg>
320346
}
321-
onClick={async () =>
347+
onClick={async () => {
348+
track("Sign In", { type: "github" });
349+
Sentry.captureEvent({
350+
message: "Sign In",
351+
level: "info",
352+
extra: {
353+
type: "github",
354+
},
355+
});
322356
await signIn.social({
323357
provider: "github",
324358
callbackURL,
325-
})
326-
}
359+
});
360+
}}
327361
/>
328362
);
329363
}

docs/content/docs/features/collaboration/comments.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ To enable comments in your editor, you need to:
1313
- provide a `resolveUsers` so BlockNote can retrieve and display user information (names and avatars).
1414
- provide a `ThreadStore` so BlockNote can store and retrieve comment threads.
1515
- enable real-time collaboration (see [Real-time collaboration](/docs/features/collaboration))
16+
- optionally provide a schema for comments and comment editors to use. If left undefined, they will use the [default comment editor schema](https://github.com/TypeCellOS/BlockNote/blob/main/packages/react/src/components/Comments/defaultCommentEditorSchema.ts). See [here](/docs/features/custom-schemas) to find out more about custom schemas.
1617

1718
```tsx
1819
const editor = useCreateBlockNote({
@@ -21,6 +22,7 @@ const editor = useCreateBlockNote({
2122
},
2223
comments: {
2324
threadStore: yourThreadStore, // see below
25+
schema: BlockNoteSchema.create(...) // optional, can be left undefined
2426
},
2527
// ...
2628
collaboration: {

docs/content/docs/foundations/document-structure.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ type CustomInlineContent = {
7272
content: StyledText[] | undefined;
7373
props: Record<string, boolean | number | string>;
7474
};
75-
```
7675

7776
type InlineContent = Link | StyledText | CustomInlineContent;
7877

docs/content/docs/reference/editor/overview.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ editor.pasteText("Hello, world!");
106106
Paste Markdown content into the editor.
107107

108108
```ts
109-
await editor.pasteMarkdown("# Hello\n\nThis is **bold** text.");
109+
editor.pasteMarkdown("# Hello\n\nThis is **bold** text.");
110110
```
111111

112112
## Options

docs/next.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const config = {
99
serverExternalPackages: ["typescript", "twoslash"],
1010
experimental: {
1111
reactCompiler: true,
12+
turbopackScopeHoisting: false,
1213
},
1314
images: {
1415
remotePatterns: [

docs/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@
3535
"@fumadocs/mdx-remote": "1.3.0",
3636
"@headlessui/react": "^1.7.19",
3737
"@heroicons/react": "^2.2.0",
38-
"@liveblocks/client": "^2.23.1",
39-
"@liveblocks/react": "^2.23.1",
40-
"@liveblocks/react-blocknote": "^2.23.1",
41-
"@liveblocks/react-tiptap": "^2.23.1",
42-
"@liveblocks/react-ui": "^2.23.1",
38+
"@liveblocks/client": "^3",
39+
"@liveblocks/react": "^3",
40+
"@liveblocks/react-blocknote": "^3",
41+
"@liveblocks/react-tiptap": "^3",
42+
"@liveblocks/react-ui": "^3",
4343
"@mantine/core": "^7.17.3",
4444
"@mui/icons-material": "^5.16.1",
4545
"@mui/material": "^5.16.1",

examples/05-interoperability/05-converting-blocks-to-pdf/src/App.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,14 @@ import {
2626
ColumnBlock,
2727
} from "@blocknote/xl-multi-column";
2828
import { PDFViewer } from "@react-pdf/renderer";
29-
import { useEffect, useMemo, useState } from "react";
29+
import { useEffect, useMemo, useReducer, useState } from "react";
3030

3131
import "./styles.css";
3232

3333
export default function App() {
3434
// Stores the editor's contents as HTML.
3535
const [pdfDocument, setPDFDocument] = useState<any>();
36+
const [renders, forceRerender] = useReducer((s) => s + 1, 0);
3637

3738
// Creates a new editor instance with some initial content.
3839
const editor = useCreateBlockNote({
@@ -403,6 +404,7 @@ export default function App() {
403404
// Converts the editor's contents from Block objects to HTML and store to state.
404405
const pdfDocument = await exporter.toReactPDFDocument(editor.document);
405406
setPDFDocument(pdfDocument);
407+
forceRerender();
406408

407409
// const blob = await ReactPDF.pdf(pdfDocument).toBlob();
408410
};
@@ -424,7 +426,9 @@ export default function App() {
424426
</BlockNoteView>
425427
</div>
426428
<div className="pdf">
427-
<PDFViewer width={"100%"}>{pdfDocument}</PDFViewer>
429+
<PDFViewer width={"100%"} key={renders}>
430+
{pdfDocument}
431+
</PDFViewer>
428432
</div>
429433
</div>
430434
);

examples/06-custom-schema/04-pdf-file-block/src/App.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
filterSuggestionItems,
55
insertOrUpdateBlock,
66
} from "@blocknote/core";
7+
import { en } from "@blocknote/core/locales";
78
import "@blocknote/core/fonts/inter.css";
89
import { BlockNoteView } from "@blocknote/mantine";
910
import "@blocknote/mantine/style.css";
@@ -17,6 +18,12 @@ import { RiFilePdfFill } from "react-icons/ri";
1718

1819
import { PDF } from "./PDF";
1920

21+
// Updated English dictionary with entries for PDF blocks.
22+
const dictionary = en;
23+
en.file_blocks.add_button_text["pdf"] = "Add PDF";
24+
en.file_panel.embed.embed_button["pdf"] = "Embed PDF";
25+
en.file_panel.upload.file_placeholder["pdf"] = "Upload PDF";
26+
2027
// Our schema with block specs, which contain the configs and implementations for blocks
2128
// that we want our editor to use.
2229
const schema = BlockNoteSchema.create({
@@ -44,6 +51,7 @@ const insertPDF = (editor: typeof schema.BlockNoteEditor) => ({
4451
export default function App() {
4552
// Creates a new editor instance.
4653
const editor = useCreateBlockNote({
54+
dictionary,
4755
schema,
4856
initialContent: [
4957
{

examples/06-custom-schema/04-pdf-file-block/src/PDF.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ export const PDF = createReactBlockSpec(
6060
render: (props) => (
6161
<ResizableFileBlockWrapper
6262
{...(props as any)}
63-
bbuttonText={"Add PDF"}
6463
buttonIcon={<RiFilePdfFill size={24} />}
6564
>
6665
<PDFPreview {...(props as any)} />

0 commit comments

Comments
 (0)