Skip to content

Commit 5ad8d6a

Browse files
committed
Merge branch 'main' into releases
# Conflicts: # package-lock.json # tests/package.json
2 parents cbc659c + 5f88e05 commit 5ad8d6a

File tree

226 files changed

+3680
-2174
lines changed

Some content is hidden

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

226 files changed

+3680
-2174
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
CI: true
6565

6666
- name: Install Playwright
67-
run: npx playwright install --with-deps
67+
run: npm run install-playwright
6868

6969
- name: Run Playwright tests
7070
working-directory: ./tests

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ blocknote
1111
└── tests - Playwright end to end tests
1212
```
1313

14-
An introduction into the BlockNote Prosemirror schema can be found in [packages/core/ARCHITECTURE.md](https://github.com/TypeCellOS/BlockNote/blob/main/packages/core/ARCHITECTURE.md).
14+
An introduction into the BlockNote Prosemirror schema can be found in [packages/core/src/pm-nodes/README.md](https://github.com/TypeCellOS/BlockNote/blob/main/packages/core/src/pm-nodes/README.md).
1515

1616
## Running
1717

docs/components/example/ExampleBlock.tsx

+20-14
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
import dynamic from "next/dynamic";
2-
import { AiFillCodeSandboxCircle, AiFillGithub } from "react-icons/ai";
2+
import { AiFillGithub } from "react-icons/ai";
3+
import { SiStackblitz } from "react-icons/si";
34

45
import { examples } from "./generated/exampleComponents.gen";
56
import "./styles.css";
67

7-
const baseGitHubURL =
8-
"https://github.com/TypeCellOS/BlockNote/tree/main/examples/";
9-
const baseCodeSandboxURL =
10-
"https://githubbox.com/TypeCellOS/BlockNote/tree/main/examples/";
8+
const baseGitHubURL = "https://github.com/TypeCellOS/BlockNote/tree/main/";
9+
// const baseCodeSandboxURL =
10+
// "https://githubbox.com/TypeCellOS/BlockNote/tree/main/";
11+
12+
const baseStackBlitzURL =
13+
"https://www.stackblitz.com/github/TypeCellOS/BlockNote/tree/main/";
1114

1215
const ThemedExample = dynamic(() => import("./ThemedExample"), {
1316
ssr: false,
1417
});
1518

1619
export function ExampleBlock(props: {
1720
name: keyof typeof examples;
21+
path: string;
1822
children: any;
1923
}) {
2024
// const example = examplesFlattened.find((e) => e.slug === props.name);
@@ -25,24 +29,26 @@ export function ExampleBlock(props: {
2529
return (
2630
<div className="demo nx-bg-primary-700/5 dark:nx-bg-primary-300/10 mt-6 rounded-lg p-4">
2731
<div className={"flex flex-row gap-6 pb-4"}>
28-
<button
32+
<a
2933
className={
3034
"nx-select-none nx-text-gray-600 hover:nx-text-black dark:nx-text-gray-200 dark:hover:nx-text-white flex flex-row items-center gap-1"
3135
}
32-
onClick={() => window.open(`${baseGitHubURL}${props.name}/`)}>
36+
href={`${baseGitHubURL}${props.path}/`}
37+
target="_blank">
3338
<AiFillGithub />
3439
<div className={"text-sm"}>GitHub</div>
35-
</button>
36-
<button
40+
</a>
41+
<a
3742
className={
3843
"nx-select-none nx-text-gray-600 hover:nx-text-black dark:nx-text-gray-200 dark:hover:nx-text-white flex flex-row items-center gap-1"
3944
}
40-
onClick={() => window.open(`${baseCodeSandboxURL}${props.name}/`)}>
41-
<AiFillCodeSandboxCircle />
42-
<div className={"text-sm"}>CodeSandbox</div>
43-
</button>
45+
href={`${baseStackBlitzURL}${props.path}/`}
46+
target="_blank">
47+
<SiStackblitz />
48+
<div className={"text-sm"}>StackBlitz</div>
49+
</a>
4450
</div>
45-
<div className={"h-96 overflow-auto rounded-lg"}>
51+
<div className={"demo-contents h-96 overflow-auto rounded-lg"}>
4652
<ThemedExample name={props.name} />
4753
</div>
4854
{props.children}

docs/components/example/styles.css

+14-13
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
11
:focus-visible {
2-
box-shadow: unset !important;
2+
box-shadow: unset !important;
33
}
44

55
.demo .nextra-code-block pre {
6-
background-color: transparent !important;
7-
margin: 0 !important;
8-
padding: 0 !important;
6+
background-color: transparent !important;
7+
margin: 0 !important;
8+
padding: 0 !important;
99
}
1010

1111
.demo .nextra-code-block code > span {
12-
padding: 0 !important;
12+
padding: 0 !important;
1313
}
1414

15-
.demo .bn-container, .demo .bn-editor {
16-
height: 100%;
15+
.demo .bn-container,
16+
.demo .bn-editor {
17+
height: 100%;
1718
}
1819

1920
.demo .bn-editor {
20-
overflow: auto;
21-
padding-block: 1rem;
21+
overflow: auto;
22+
padding-block: 1rem;
2223
}
2324

24-
.demo a {
25-
color: revert;
26-
text-decoration: revert;
27-
}
25+
.demo-contents a {
26+
color: revert;
27+
text-decoration: revert;
28+
}

docs/components/pages/landing/gradients.css

+13-1
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,20 @@ section {
1111
--bg-color: #000000;
1212
}
1313

14-
.editor-glow {
14+
.demo-glow {
1515
--glow-opacity: 0.4;
16+
display: block;
17+
}
18+
19+
.text-glow {
20+
--glow-opacity: 0.2;
21+
display: none;
22+
@media only screen and (hover: none) and (pointer: coarse) {
23+
display: block; /* disable on mobile */
24+
}
25+
}
26+
27+
.hero-glow {
1628
background: conic-gradient(
1729
from 33deg at 50% 50%,
1830
hsla(var(--glow-blue), var(--glow-opacity)),

docs/components/pages/landing/hero/Demo.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ const DemoEditor = dynamic(
2929
},
3030
);
3131

32-
export function Demo(props: { theme: "light" | "dark" }) {
32+
export function Demo(props: { theme?: "light" | "dark" }) {
3333
return (
34-
<div className="hero relative h-[36rem] w-full shrink-0 grow-0 rounded-lg xl:w-[584px]">
35-
<div className="editor-glow absolute z-10 h-full w-full" />
34+
<div className="hero-demo relative h-[36rem] w-full shrink-0 grow-0 rounded-lg sm:block xl:w-[584px]">
35+
<div className="hero-glow demo-glow absolute z-10 h-full w-full" />
3636
<div className="relative z-20 h-full w-full rounded-lg bg-white dark:bg-[#202020]">
37-
<DemoEditor theme={props.theme === "dark" ? "dark" : "light"} />
37+
<DemoEditor theme={props.theme} />
3838
</div>
3939
<TryHereImage />
4040
</div>

docs/components/pages/landing/hero/DemoEditor.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import { useCallback, useMemo, useState } from "react";
66
import YPartyKitProvider from "y-partykit/provider";
77
import * as Y from "yjs";
88

9-
import "./styles.css";
10-
119
const colors = [
1210
"#958DF1",
1311
"#F98181",
@@ -54,9 +52,8 @@ function getUTCDateYYYYMMDD() {
5452
return `${year}${formattedMonth}${formattedDay}`;
5553
}
5654

57-
export default function DemoEditor(props: { theme: "light" | "dark" }) {
55+
export default function DemoEditor(props: { theme?: "light" | "dark" }) {
5856
const [doc, provider] = useMemo(() => {
59-
console.log("create");
6057
const doc = new Y.Doc();
6158
const provider = new YPartyKitProvider(
6259
"blocknote.yousefed.partykit.dev",

docs/components/pages/landing/hero/Hero.tsx

+9-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { Text } from "@/components/pages/landing/hero/Text";
44
import { Demo } from "@/components/pages/landing/hero/Demo";
55
import { FadeIn } from "@/components/pages/landing/shared/FadeIn";
66

7+
import "./styles.css";
8+
79
export function Hero() {
810
const { theme } = useTheme();
911

@@ -15,7 +17,13 @@ export function Hero() {
1517
"z-20 flex w-full flex-col items-center justify-between gap-6 px-6 md:max-w-screen-md xl:max-w-[1440px] xl:flex-row"
1618
}>
1719
<Text />
18-
<Demo theme={theme === "dark" ? "dark" : "light"} />
20+
<Demo
21+
theme={
22+
theme === undefined || theme === "system"
23+
? undefined
24+
: (theme as "light" | "dark" | undefined)
25+
}
26+
/>
1927
</FadeIn>
2028
</Section>
2129
);

docs/components/pages/landing/hero/Text.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@ import { CTAButton } from "@/components/pages/landing/shared/CTAButton";
66

77
export function Text() {
88
return (
9-
<div className="flex h-fit flex-col items-center justify-center gap-6 text-center xl:w-[584px] xl:items-start xl:text-left">
10-
<HeroText h1>
9+
<div className="relative flex h-fit flex-col items-center justify-center gap-6 text-center xl:w-[584px] xl:items-start xl:text-left">
10+
<div className="hero-glow text-glow absolute block h-full w-full sm:hidden" />
11+
<HeroText h1 className={"z-10"}>
1112
The open source
1213
<br />
1314
<strong>Block-Based</strong>
1415
<br />
1516
rich text editor
1617
</HeroText>
17-
<SectionSubtext>
18+
<SectionSubtext className={"z-10"}>
1819
A beautiful text editor that just works. Easily add an editor to your
1920
app that users will love. Customize it with your own functionality like
2021
custom blocks or AI tooling.
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
1-
.hero .bn-container, .hero .bn-editor {
1+
.hero-demo {
2+
@media only screen and (hover: none) and (pointer: coarse) {
3+
display: none; /* disable on mobile */
4+
}
5+
}
6+
7+
.hero-demo .bn-container, .hero-demo .bn-editor {
28
height: 100%
39
}
410

5-
.hero .bn-editor {
11+
.hero-demo .bn-editor {
612
overflow: auto;
713
min-height: 100%;
814
/* Removes focus outline */
915
box-shadow: none !important;
1016
padding-block: 1rem
1117
}
1218

13-
.hero a {
19+
.hero-demo a {
1420
color: revert;
1521
text-decoration: revert;
1622
}

docs/components/pages/landing/shared/Headings.tsx

+11-2
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,19 @@ export function SectionSubHeader({ children }: { children: React.ReactNode }) {
4848
);
4949
}
5050

51-
export function SectionSubtext({ children }: { children: React.ReactNode }) {
51+
export function SectionSubtext({
52+
children,
53+
className,
54+
}: {
55+
children: React.ReactNode;
56+
className?: string;
57+
}) {
5258
return (
5359
<p
54-
className={`font-space-grotesk text-lg leading-snug text-[#00000080] dark:text-[#FFFFFFB2] md:text-xl`}>
60+
className={cn(
61+
"font-space-grotesk text-lg leading-snug text-[#00000080] dark:text-[#FFFFFFB2] md:text-xl",
62+
className,
63+
)}>
5564
{children}
5665
</p>
5766
);

docs/components/pages/landing/styles.css

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
}
99

1010
.nextra-nav-container {
11+
z-index: 40;
12+
}
13+
14+
.nextra-sidebar-container {
1115
z-index: 30;
1216
}
1317

docs/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"@headlessui/react": "^1.7.18",
1515
"@mantine/core": "^7.5.0",
1616
"@next/bundle-analyzer": "^14.1.0",
17+
"@vercel/analytics": "^1.2.2",
1718
"@vercel/og": "^0.6.2",
1819
"classnames": "2.3.2",
1920
"clsx": "^2.1.0",

docs/pages/_app.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// import "../custom.css";
2+
import { Analytics } from "@vercel/analytics/react";
23
import { SessionProvider } from "next-auth/react";
34
import type { AppProps } from "next/app";
45
import { type ReactNode } from "react";
@@ -17,6 +18,7 @@ export default function Nextra({ Component, pageProps }: NextraAppProps) {
1718
<>
1819
<SessionProvider>
1920
<Component {...pageProps} />
21+
<Analytics />
2022
</SessionProvider>
2123
</>
2224
);

docs/pages/_document.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
import { Analytics } from "@vercel/analytics/react";
12
import type { DocumentContext, DocumentInitialProps } from "next/document";
23
import Document, { Head, Html, Main, NextScript } from "next/document";
34
class MyDocument extends Document {
45
static async getInitialProps(
5-
ctx: DocumentContext
6+
ctx: DocumentContext,
67
): Promise<DocumentInitialProps> {
78
const initialProps = await Document.getInitialProps(ctx);
89

@@ -16,6 +17,7 @@ class MyDocument extends Document {
1617
<body>
1718
<Main />
1819
<NextScript />
20+
<Analytics />
1921
</body>
2022
</Html>
2123
);

docs/pages/docs/advanced/real-time-collaboration.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Let's see how you can add Multiplayer capabilities to your BlockNote setup, and
1111

1212
<img
1313
style={{ maxWidth: "300px", border: "1px solid gray" }}
14-
src="/img/features/collaboration.gif"
14+
src="/img/features/collaboration_light.gif"
1515
alt="text editing collaboration"
1616
/>
1717

docs/pages/docs/advanced/vanilla-js.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ While it's up to you to decide how you want the elements to be rendered, BlockNo
4949
```typescript
5050
type UIElement =
5151
| "formattingToolbar"
52-
| "hyperlinkToolbar"
52+
| "linkToolbar"
5353
| "imageToolbar"
5454
| "sideMenu"
5555
| "suggestionMenu"

docs/pages/docs/custom-schemas.mdx

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@ However, you can extend BlockNote and create custom schemas to support your own
1212

1313
Blocks are the main elements of a document, such as paragraphs, headings, lists, etc.
1414

15-
- [Learn how to create custom blocks for your BlockNote editor](/docs/custom-schemas/blocks)
15+
- [Learn how to create custom blocks for your BlockNote editor](/docs/custom-schemas/custom-blocks)
1616

1717
## Custom Inline Content
1818

1919
Inline Content are elements that can be inserted inside a text block, such as links, mentions, tags, etc.
2020

21-
- [Learn how to create custom Inline Content for your BlockNote editor](/docs/custom-schemas/inline-content)
21+
- [Learn how to create custom Inline Content for your BlockNote editor](/docs/custom-schemas/custom-inline-content)
2222

2323
## Custom Styles
2424

2525
Text Styles are properties that can be applied to a piece of text, such as bold, italic, underline, etc.
2626

27-
- [Learn how to add custom Styles to your BlockNote editor](/docs/custom-schemas/styles)
27+
- [Learn how to add custom Styles to your BlockNote editor](/docs/custom-schemas/custom-styles)
2828

2929
## Creating your own schema
3030

@@ -96,4 +96,4 @@ type MyPartialBlock = typeof schema.PartialBlock;
9696

9797
### Automatically override all default types (experimental)
9898

99-
Alternatively, the easiest way to get full type safety without any additional work is to override all default types with your custom schema, by using a custom type definition file. See this [example blocknote.d.ts](https://github.com/TypeCellOS/BlockNote/blob/main/examples/06-custom-schema/react-custom-styles/blocknote.d.ts.example). This is an experimental feature - we would love to hear your feedback on this approach.
99+
Alternatively, the easiest way to get full type safety without any additional work is to override all default types with your custom schema, by using a custom type definition file. See this [example blocknote.d.ts](https://github.com/TypeCellOS/BlockNote/blob/main/examples/05-custom-schema/react-custom-styles/blocknote.d.ts.example). This is an experimental feature - we would love to hear your feedback on this approach.

docs/pages/docs/custom-schemas/custom-inline-content.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Defines the identifier of the custom inline content.
5656

5757
**`content`**
5858

59-
`styled` if your custom inline content should support [styled text content](/docs/editor-api/block-content#styled-text), `none` if not.
59+
`styled` if your custom inline content should contain [`StyledText`](/docs/editor-basics/document-structure#inline-content-objects), `none` if not.
6060

6161
_In the mentions demo, we want each mention to be a single, non-editable element, so we set it to `"none"`._
6262

0 commit comments

Comments
 (0)