Skip to content

Commit 666ab84

Browse files
committed
hack around TextAlignButton types
1 parent a4fdca4 commit 666ab84

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

packages/react/src/FormattingToolbar/components/DefaultButtons/TextAlignButton.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import {
22
BlockNoteEditor,
3-
BlockSchema,
3+
DefaultBlockSchema,
44
DefaultProps,
5-
PartialBlock,
65
} from "@blocknote/core";
76
import { useCallback } from "react";
87
import { IconType } from "react-icons";
@@ -23,8 +22,8 @@ const icons: Record<TextAlignment, IconType> = {
2322
justify: RiAlignJustify,
2423
};
2524

26-
export const TextAlignButton = <BSchema extends BlockSchema>(props: {
27-
editor: BlockNoteEditor<BSchema>;
25+
export const TextAlignButton = (props: {
26+
editor: BlockNoteEditor<DefaultBlockSchema>;
2827
textAlignment: TextAlignment;
2928
}) => {
3029
const setTextAlignment = useCallback(
@@ -37,12 +36,12 @@ export const TextAlignButton = <BSchema extends BlockSchema>(props: {
3736
for (const block of selection.blocks) {
3837
props.editor.updateBlock(block, {
3938
props: { textAlignment: textAlignment },
40-
} as PartialBlock<BSchema>);
39+
});
4140
}
4241
} else {
4342
props.editor.updateBlock(props.editor.getTextCursorPosition().block, {
4443
props: { textAlignment: textAlignment },
45-
} as PartialBlock<BSchema>);
44+
});
4645
}
4746
},
4847
[props.editor]

packages/react/src/FormattingToolbar/components/FormattingToolbar.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { BlockNoteEditor, BlockSchema } from "@blocknote/core";
22
import { Toolbar } from "../../SharedComponents/Toolbar/components/Toolbar";
3-
import { BlockTypeDropdown } from "./DefaultDropdowns/BlockTypeDropdown";
4-
import { ToggledStyleButton } from "./DefaultButtons/ToggledStyleButton";
5-
import { TextAlignButton } from "./DefaultButtons/TextAlignButton";
63
import { ColorStyleButton } from "./DefaultButtons/ColorStyleButton";
4+
import { CreateLinkButton } from "./DefaultButtons/CreateLinkButton";
75
import {
86
NestBlockButton,
97
UnnestBlockButton,
108
} from "./DefaultButtons/NestBlockButtons";
11-
import { CreateLinkButton } from "./DefaultButtons/CreateLinkButton";
9+
import { TextAlignButton } from "./DefaultButtons/TextAlignButton";
10+
import { ToggledStyleButton } from "./DefaultButtons/ToggledStyleButton";
11+
import { BlockTypeDropdown } from "./DefaultDropdowns/BlockTypeDropdown";
1212

1313
export const FormattingToolbar = <BSchema extends BlockSchema>(props: {
1414
editor: BlockNoteEditor<BSchema>;
@@ -22,9 +22,9 @@ export const FormattingToolbar = <BSchema extends BlockSchema>(props: {
2222
<ToggledStyleButton editor={props.editor} toggledStyle={"underline"} />
2323
<ToggledStyleButton editor={props.editor} toggledStyle={"strike"} />
2424

25-
<TextAlignButton editor={props.editor} textAlignment={"left"} />
26-
<TextAlignButton editor={props.editor} textAlignment={"center"} />
27-
<TextAlignButton editor={props.editor} textAlignment={"right"} />
25+
<TextAlignButton editor={props.editor as any} textAlignment={"left"} />
26+
<TextAlignButton editor={props.editor as any} textAlignment={"center"} />
27+
<TextAlignButton editor={props.editor as any} textAlignment={"right"} />
2828

2929
<ColorStyleButton editor={props.editor} />
3030

0 commit comments

Comments
 (0)