Skip to content

Commit 4cdf8a7

Browse files
committed
merge / undo button separation
1 parent 4de0e4e commit 4cdf8a7

File tree

33 files changed

+70
-63
lines changed

33 files changed

+70
-63
lines changed

examples/03-ui-components/02-formatting-toolbar-buttons/BlueButton.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
import "@blocknote/mantine/style.css";
12
import {
23
useBlockNoteEditor,
34
useComponentsContext,
45
useEditorContentOrSelectionChange,
56
} from "@blocknote/react";
6-
import "@blocknote/mantine/style.css";
77
import { useState } from "react";
88

99
// Custom Formatting Toolbar Button to toggle blue text & background color.
@@ -27,7 +27,7 @@ export function BlueButton() {
2727
}, editor);
2828

2929
return (
30-
<Components.Toolbar.Button
30+
<Components.FormattingToolbar.Button
3131
mainTooltip={"Blue Text & Background"}
3232
onClick={() => {
3333
editor.toggleStyles({
@@ -37,6 +37,6 @@ export function BlueButton() {
3737
}}
3838
isSelected={isSelected}>
3939
Blue
40-
</Components.Toolbar.Button>
40+
</Components.FormattingToolbar.Button>
4141
);
4242
}

examples/03-ui-components/11-uppy-file-panel/FileReplaceButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export const FileReplaceButton = () => {
4949
return (
5050
<Components.Generic.Popover.Root opened={isOpen} position={"bottom"}>
5151
<Components.Generic.Popover.Trigger>
52-
<Components.Toolbar.Button
52+
<Components.FormattingToolbar.Button
5353
className={"bn-button"}
5454
onClick={() => setIsOpen(!isOpen)}
5555
isSelected={isOpen}

examples/03-ui-components/link-toolbar-buttons/AlertButton.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ export function AlertButton(props: LinkToolbarProps) {
55
const Components = useComponentsContext()!;
66

77
return (
8-
<Components.Toolbar.Button
8+
<Components.LinkToolbar.Button
99
mainTooltip={"Open Alert with URL"}
1010
onClick={() => {
1111
window.alert(`Link URL: ${props.url}`);
1212
}}>
1313
Open Alert
14-
</Components.Toolbar.Button>
14+
</Components.LinkToolbar.Button>
1515
);
1616
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const SetFontStyleButton = () => {
4545
const Components = useComponentsContext()!;
4646

4747
return (
48-
<Components.Toolbar.Button
48+
<Components.FormattingToolbar.Button
4949
label="Set Font"
5050
mainTooltip={"Set Font"}
5151
icon={<RiText />}

examples/06-custom-schema/react-custom-styles/App.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import { BlockNoteSchema, defaultStyleSpecs } from "@blocknote/core";
22
import "@blocknote/core/fonts/inter.css";
3+
import { BlockNoteView } from "@blocknote/mantine";
4+
import "@blocknote/mantine/style.css";
35
import {
4-
createReactStyleSpec,
56
FormattingToolbar,
67
FormattingToolbarController,
78
FormattingToolbarProps,
9+
createReactStyleSpec,
810
useActiveStyles,
911
useBlockNoteEditor,
1012
useComponentsContext,
1113
useCreateBlockNote,
1214
} from "@blocknote/react";
13-
import { BlockNoteView } from "@blocknote/mantine";
14-
import "@blocknote/mantine/style.css";
1515

1616
const small = createReactStyleSpec(
1717
{
@@ -55,7 +55,7 @@ const CustomFormattingToolbar = (props: FormattingToolbarProps) => {
5555

5656
return (
5757
<FormattingToolbar>
58-
<Components.Toolbar.Button
58+
<Components.FormattingToolbar.Button
5959
mainTooltip={"small"}
6060
onClick={() => {
6161
editor.toggleStyles({
@@ -64,8 +64,8 @@ const CustomFormattingToolbar = (props: FormattingToolbarProps) => {
6464
}}
6565
isSelected={activeStyles.small}>
6666
Small
67-
</Components.Toolbar.Button>
68-
<Components.Toolbar.Button
67+
</Components.FormattingToolbar.Button>
68+
<Components.FormattingToolbar.Button
6969
mainTooltip={"font size"}
7070
onClick={() => {
7171
editor.toggleStyles({
@@ -74,7 +74,7 @@ const CustomFormattingToolbar = (props: FormattingToolbarProps) => {
7474
}}
7575
isSelected={!!activeStyles.fontSize}>
7676
Font size
77-
</Components.Toolbar.Button>
77+
</Components.FormattingToolbar.Button>
7878
</FormattingToolbar>
7979
);
8080
};

examples/vanilla-js/react-vanilla-custom-styles/App.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import {
44
defaultStyleSpecs,
55
} from "@blocknote/core";
66
import "@blocknote/core/fonts/inter.css";
7+
import { BlockNoteView } from "@blocknote/mantine";
8+
import "@blocknote/mantine/style.css";
79
import {
810
FormattingToolbar,
911
FormattingToolbarController,
@@ -13,8 +15,6 @@ import {
1315
useComponentsContext,
1416
useCreateBlockNote,
1517
} from "@blocknote/react";
16-
import { BlockNoteView } from "@blocknote/mantine";
17-
import "@blocknote/mantine/style.css";
1818

1919
const small = createStyleSpec(
2020
{
@@ -67,7 +67,7 @@ const CustomFormattingToolbar = (props: FormattingToolbarProps) => {
6767

6868
return (
6969
<FormattingToolbar>
70-
<Components.Toolbar.Button
70+
<Components.FormattingToolbar.Button
7171
mainTooltip={"small"}
7272
onClick={() => {
7373
editor.toggleStyles({
@@ -76,8 +76,8 @@ const CustomFormattingToolbar = (props: FormattingToolbarProps) => {
7676
}}
7777
isSelected={activeStyles.small}>
7878
Small
79-
</Components.Toolbar.Button>
80-
<Components.Toolbar.Button
79+
</Components.FormattingToolbar.Button>
80+
<Components.FormattingToolbar.Button
8181
mainTooltip={"font size"}
8282
onClick={() => {
8383
editor.toggleStyles({
@@ -86,7 +86,7 @@ const CustomFormattingToolbar = (props: FormattingToolbarProps) => {
8686
}}
8787
isSelected={!!activeStyles.fontSize}>
8888
Font size
89-
</Components.Toolbar.Button>
89+
</Components.FormattingToolbar.Button>
9090
</FormattingToolbar>
9191
);
9292
};

package-lock.json

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

packages/ariakit/src/toolbar/Toolbar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { assertEmpty, mergeCSSClasses } from "@blocknote/core";
44
import { ComponentProps } from "@blocknote/react";
55
import { forwardRef } from "react";
66

7-
type ToolbarProps = ComponentProps["Toolbar"]["Root"];
7+
type ToolbarProps = ComponentProps["Generic"]["Toolbar"]["Root"];
88

99
export const Toolbar = forwardRef<HTMLDivElement, ToolbarProps>(
1010
(props, ref) => {

packages/ariakit/src/toolbar/ToolbarButton.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import {
2+
ToolbarItem as AriakitToolbarItem,
23
Tooltip as AriakitTooltip,
34
TooltipAnchor as AriakitTooltipAnchor,
4-
ToolbarItem as AriakitToolbarItem,
55
TooltipProvider as AriakitTooltipProvider,
66
} from "@ariakit/react";
77

88
import { assertEmpty, isSafari, mergeCSSClasses } from "@blocknote/core";
99
import { ComponentProps } from "@blocknote/react";
1010
import { forwardRef } from "react";
1111

12-
type ToolbarButtonProps = ComponentProps["Toolbar"]["Button"];
12+
type ToolbarButtonProps = ComponentProps["Generic"]["Toolbar"]["Button"];
1313

1414
/**
1515
* Helper for basic buttons that show in the formatting toolbar.

packages/ariakit/src/toolbar/ToolbarSelect.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { forwardRef } from "react";
1414

1515
export const ToolbarSelect = forwardRef<
1616
HTMLDivElement,
17-
ComponentProps["Toolbar"]["Select"]
17+
ComponentProps["FormattingToolbar"]["Select"]
1818
>((props, ref) => {
1919
const { className, items, isDisabled, ...rest } = props;
2020

0 commit comments

Comments
 (0)