Skip to content

Commit 3346ee0

Browse files
refactor: Clean up component code (#637)
* Cleaned up component code * Renamed "Link" in components to "Hyperlink" * Implemented PR feedback * alternative solution for toolbar fadeout (#645) * chore: Playwright update (#640) * Updated playwright * Small fix * dont upgrade tiptap etc * fix pw install? --------- Co-authored-by: yousefed <[email protected]> * fix `setEditable` called when not necessary (#635) * Added temp fix for shortcuts and input rules in tables (#561) --------- Co-authored-by: Yousef <[email protected]>
1 parent 141175c commit 3346ee0

File tree

43 files changed

+1686
-495
lines changed

Some content is hidden

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

43 files changed

+1686
-495
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
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

docs/pages/docs/ui-components/formatting-toolbar.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@ Setting `formattingToolbar={false}` on `BlockNoteView` tells BlockNote not to sh
3232
<div className="nx-mt-6 nx-leading-7 first:nx-mt-0">
3333
<small>
3434
<strong>Tip:</strong> The children you pass to the `FormattingToolbar` component
35-
should be default dropdowns/buttons (e.g. `BlockTypeDropdown` & `BasicTextStyleButton`) or custom dropdowns/buttons
36-
(`ToolbarDropdown` & `ToolbarButton`). To see all the components you can use, head to the
35+
should be default selects/buttons (e.g. `BlockTypeSelect` & `BasicTextStyleButton`) or custom selects/buttons
36+
(`ToolbarSelect` & `ToolbarButton`). To see all the components you can use, head to the
3737
[Formatting Toolbar's source code](https://github.com/TypeCellOS/BlockNote/blob/main/packages/react/src/components/FormattingToolbar/mantine/FormattingToolbar.tsx).
3838
</small>
3939
</div>
4040

41-
## Changing Block Type Dropdown Items
41+
## Changing Block Type Select (Dropdown) Items
4242

43-
The first element in the default Formatting Toolbar is the Block Type Dropdown, and you can change the items in it. The demo makes the Block Type Dropdown work for image blocks by adding an item to it.
43+
The first element in the default Formatting Toolbar is the Block Type Select, and you can change the items in it. The demo makes the Block Type Select work for image blocks by adding an item to it.
4444

4545
<Example name="ui-components/formatting-toolbar-block-type-items" />
4646

47-
Here, we use the `FormattingToolbar` component but keep the default buttons (we don't pass any children). Instead, we pass our customized Block Type Dropdown items using the `blockTypeDropdownItems` prop.
47+
Here, we use the `FormattingToolbar` component but keep the default buttons (we don't pass any children). Instead, we pass our customized Block Type Select items using the `blockTypeSelectItems` prop.

docs/pages/docs/ui-components/hyperlink-toolbar.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ Setting `hyperlinkToolbar={false}` on `BlockNoteView` tells BlockNote not to sho
3030
<div className="nx-mt-6 nx-leading-7 first:nx-mt-0">
3131
<small>
3232
<strong>Tip:</strong> The children you pass to the `HyperlinkToolbar`
33-
component should be default buttons (e.g. TODO) or custom dropdowns/buttons
34-
(`ToolbarDropdown` & `ToolbarButton`). To see all the components you can
33+
component should be default buttons (e.g. TODO) or custom selects/buttons
34+
(`ToolbarSelect` & `ToolbarButton`). To see all the components you can
3535
use, head to the [Hyperlink Toolbar's source code](link).
3636
</small>
3737
</div>

examples/02-ui-components/02-formatting-toolbar-buttons/App.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import "@blocknote/core/fonts/inter.css";
22
import {
33
BasicTextStyleButton,
44
BlockNoteView,
5-
BlockTypeDropdown,
5+
BlockTypeSelect,
66
ColorStyleButton,
7-
CreateLinkButton,
7+
CreateHyperlinkButton,
88
FormattingToolbar,
99
FormattingToolbarController,
1010
ImageCaptionButton,
@@ -72,7 +72,7 @@ export default function App() {
7272
<FormattingToolbarController
7373
formattingToolbar={() => (
7474
<FormattingToolbar>
75-
<BlockTypeDropdown key={"blockTypeDropdown"} />
75+
<BlockTypeSelect key={"blockTypeSelect"} />
7676

7777
{/* Extra button to toggle blue text & background */}
7878
<BlueButton key={"customButton"} />
@@ -120,7 +120,7 @@ export default function App() {
120120
<NestBlockButton key={"nestBlockButton"} />
121121
<UnnestBlockButton key={"unnestBlockButton"} />
122122

123-
<CreateLinkButton key={"createLinkButton"} />
123+
<CreateHyperlinkButton key={"createLinkButton"} />
124124
</FormattingToolbar>
125125
)}
126126
/>

examples/02-ui-components/03-formatting-toolbar-block-type-items/App.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import { BlockNoteSchema, defaultBlockSpecs } from "@blocknote/core";
22
import "@blocknote/core/fonts/inter.css";
33
import {
44
BlockNoteView,
5-
BlockTypeDropdownItem,
65
FormattingToolbar,
76
FormattingToolbarController,
8-
blockTypeDropdownItems,
97
useCreateBlockNote,
8+
blockTypeSelectItems,
9+
BlockTypeSelectItem,
1010
} from "@blocknote/react";
1111
import "@blocknote/react/style.css";
1212
import { RiAlertFill } from "react-icons/ri";
@@ -36,33 +36,33 @@ export default function App() {
3636
{
3737
type: "paragraph",
3838
content:
39-
"Try selecting some text - you'll see the new 'Alert' item in the Block Type Dropdown",
39+
"Try selecting some text - you'll see the new 'Alert' item in the Block Type Select",
4040
},
4141
{
4242
type: "alert",
4343
content:
44-
"Or select text in this alert - the Block Type Dropdown also appears",
44+
"Or select text in this alert - the Block Type Select also appears",
4545
},
4646
{
4747
type: "paragraph",
4848
},
4949
],
5050
});
5151

52-
// Renders the editor instance with the updated Block Type Dropdown.
52+
// Renders the editor instance with the updated Block Type Select.
5353
return (
5454
<BlockNoteView editor={editor} formattingToolbar={false}>
5555
<FormattingToolbarController
5656
formattingToolbar={() => (
5757
<FormattingToolbar
58-
blockTypeDropdownItems={[
59-
...blockTypeDropdownItems,
58+
blockTypeSelectItems={[
59+
...blockTypeSelectItems,
6060
{
6161
name: "Alert",
6262
type: "alert",
6363
icon: RiAlertFill,
6464
isSelected: (block) => block.type === "alert",
65-
} satisfies BlockTypeDropdownItem,
65+
} satisfies BlockTypeSelectItem,
6666
]}
6767
/>
6868
)}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# Adding Block Type Dropdown Items
1+
# Adding Block Type Select Items
22

3-
In this example, we add an item to the Block Type Dropdown, so that it works for a custom alert block we create.
3+
In this example, we add an item to the Block Type Select, so that it works for a custom alert block we create.
44

5-
**Try it out:** Select some text to open the Formatting Toolbar, and click "Alert" in the Block Type Dropdown to change the selected block!
5+
**Try it out:** Select some text to open the Formatting Toolbar, and click "Alert" in the Block Type Select to change the selected block!
66

77
**Relevant Docs:**
88

9-
- [Changing Block Type Dropdown Items](/docs/ui-components/formatting-toolbar#changing-block-type-dropdown-items)
9+
- [Changing Block Type Select Items](/docs/ui-components/formatting-toolbar#changing-block-type-select-items)
1010
- [Custom Block Types](/docs/custom-schemas/custom-blocks)
1111
- [Editor Setup](/docs/editor-basics/setup)

examples/02-ui-components/03-formatting-toolbar-block-type-items/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</script>
66
<meta charset="UTF-8" />
77
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
8-
<title>Adding Block Type Dropdown Items</title>
8+
<title>Adding Block Type Select Items</title>
99
</head>
1010
<body>
1111
<div id="root"></div>

examples/05-custom-schema/03-font-style/App.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import "@blocknote/core/fonts/inter.css";
33
import {
44
BasicTextStyleButton,
55
BlockNoteView,
6-
BlockTypeDropdown,
6+
BlockTypeSelect,
77
ColorStyleButton,
8-
CreateLinkButton,
8+
CreateHyperlinkButton,
99
FormattingToolbar,
1010
FormattingToolbarController,
1111
ImageCaptionButton,
@@ -99,7 +99,7 @@ export default function App() {
9999
<FormattingToolbarController
100100
formattingToolbar={() => (
101101
<FormattingToolbar>
102-
<BlockTypeDropdown key={"blockTypeDropdown"} />
102+
<BlockTypeSelect key={"blockTypeSelect"} />
103103

104104
<ImageCaptionButton key={"imageCaptionButton"} />
105105
<ReplaceImageButton key={"replaceImageButton"} />
@@ -141,7 +141,7 @@ export default function App() {
141141
<NestBlockButton key={"nestBlockButton"} />
142142
<UnnestBlockButton key={"unnestBlockButton"} />
143143

144-
<CreateLinkButton key={"createLinkButton"} />
144+
<CreateHyperlinkButton key={"createLinkButton"} />
145145
</FormattingToolbar>
146146
)}
147147
/>

0 commit comments

Comments
 (0)