Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions docs/content/pages/thanks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ Your support means the world to us and helps us continue developing and maintain

## What's Next?

- **Access to Examples:** You now have full access to our comprehensive [examples](/examples) to help you get the most out of BlockNote.
- **Get started with BlockNote:** Head to our [documentation](/docs) to get started with BlockNote.
- **Priority GitHub Support:** As a subscriber, your GitHub issues will be prioritized, ensuring a faster resolution.
- **Private Discord Channel:** Want to connect with us and other power users? Contact us via our [about page](/about) to get an invite to our private Discord channel.
- **Showcase Your Support:** We'd love to show our gratitude for your sponsorship! If you'd like, you can send us your company logo by contacting us via our [about page](/about), and we'll feature it on our site.

We truly appreciate your subscription and your commitment to open-source software.
Expand Down
4 changes: 2 additions & 2 deletions packages/ariakit/src/badge/Badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {

import { assertEmpty, mergeCSSClasses } from "@blocknote/core";
import { ComponentProps } from "@blocknote/react";
import { forwardRef } from "react";
import { type MouseEvent, forwardRef } from "react";

export const Badge = forwardRef<
HTMLButtonElement,
Expand Down Expand Up @@ -36,7 +36,7 @@ export const Badge = forwardRef<
isSelected && "bn-ak-primary",
)}
aria-selected={isSelected === true}
onClick={(event) => onClick?.(event)}
onClick={(event: MouseEvent<HTMLButtonElement>) => onClick?.(event)}
onMouseEnter={onMouseEnter}
ref={ref}
>
Expand Down
2 changes: 1 addition & 1 deletion packages/ariakit/src/panel/Panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const Panel = forwardRef<
<AriakitTabProvider
defaultSelectedId={defaultOpenTab}
selectedId={openTab}
setActiveId={(activeId) => {
setActiveId={(activeId: string | null | undefined) => {
if (activeId) {
setOpenTab(activeId);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/ariakit/src/panel/PanelFileInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {

import { assertEmpty } from "@blocknote/core";
import { ComponentProps } from "@blocknote/react";
import { forwardRef } from "react";
import { forwardRef, type ChangeEvent } from "react";

export const PanelFileInput = forwardRef<
HTMLInputElement,
Expand All @@ -24,7 +24,7 @@ export const PanelFileInput = forwardRef<
type={"file"}
accept={accept}
value={value ? value.name : undefined}
onChange={async (e) => onChange?.(e.target.files![0])}
onChange={async (e: ChangeEvent<HTMLInputElement>) => onChange?.(e.target.files![0])}
placeholder={placeholder}
/>
</AriakitFormProvider>
Expand Down
4 changes: 2 additions & 2 deletions packages/ariakit/src/toolbar/ToolbarButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {

import { assertEmpty, isSafari, mergeCSSClasses } from "@blocknote/core";
import { ComponentProps } from "@blocknote/react";
import { forwardRef } from "react";
import { forwardRef, type MouseEvent } from "react";

type ToolbarButtonProps = ComponentProps["Generic"]["Toolbar"]["Button"];

Expand Down Expand Up @@ -46,7 +46,7 @@ export const ToolbarButton = forwardRef<HTMLButtonElement, ToolbarButtonProps>(
)}
// Needed as Safari doesn't focus button elements on mouse down
// unlike other browsers.
onMouseDown={(e) => {
onMouseDown={(e: MouseEvent<HTMLButtonElement>) => {
if (isSafari()) {
(e.currentTarget as HTMLButtonElement).focus();
}
Expand Down
20 changes: 19 additions & 1 deletion packages/core/src/editor/BlockNoteEditor.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { expect, it } from "vitest";
import { afterEach, expect, it } from "vitest";
import * as Y from "yjs";

import {
Expand All @@ -11,15 +11,27 @@ import { BlocksChanged } from "../api/getBlocksChangedByTransaction.js";
/**
* @vitest-environment jsdom
*/

const editorsToCleanup: BlockNoteEditor<any, any, any>[] = [];

afterEach(() => {
for (const editor of editorsToCleanup) {
editor.unmount();
}
editorsToCleanup.length = 0;
});

it("creates an editor", () => {
const editor = BlockNoteEditor.create();
editorsToCleanup.push(editor);
const posInfo = editor.transact((tr) => getNearestBlockPos(tr.doc, 2));
const info = getBlockInfo(posInfo);
expect(info.blockNoteType).toEqual("paragraph");
});

it("immediately replaces doc", async () => {
const editor = BlockNoteEditor.create();
editorsToCleanup.push(editor);
const blocks = await editor.tryParseMarkdownToBlocks(
"This is a normal text\n\n# And this is a large heading",
);
Expand Down Expand Up @@ -70,6 +82,7 @@ it("adds id attribute when requested", async () => {
const editor = BlockNoteEditor.create({
setIdAttribute: true,
});
editorsToCleanup.push(editor);
const blocks = await editor.tryParseMarkdownToBlocks(
"This is a normal text\n\n# And this is a large heading",
);
Expand All @@ -81,6 +94,7 @@ it("adds id attribute when requested", async () => {

it("updates block", () => {
const editor = BlockNoteEditor.create();
editorsToCleanup.push(editor);
editor.updateBlock(editor.document[0], {
content: "hello",
});
Expand All @@ -89,6 +103,7 @@ it("updates block", () => {
it("block prop types", () => {
// this test checks whether the block props are correctly typed in typescript
const editor = BlockNoteEditor.create();
editorsToCleanup.push(editor);
const block = editor.document[0];
if (block.type === "paragraph") {
// @ts-expect-error
Expand All @@ -108,6 +123,7 @@ it("block prop types", () => {

it("onMount and onUnmount", async () => {
const editor = BlockNoteEditor.create();
editorsToCleanup.push(editor);
let mounted = false;
let unmounted = false;
editor.onMount(() => {
Expand Down Expand Up @@ -143,6 +159,7 @@ it("sets an initial block id when using Y.js", async () => {
},
},
});
editorsToCleanup.push(editor);

editor.mount(document.createElement("div"));

Expand Down Expand Up @@ -193,6 +210,7 @@ it("sets an initial block id when using Y.js", async () => {

it("onBeforeChange", () => {
const editor = BlockNoteEditor.create();
editorsToCleanup.push(editor);
let beforeChangeCalled = false;
let changes: BlocksChanged<any, any, any> = [];
editor.onBeforeChange(({ getChanges }) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/xl-ai/src/components/AIMenu/AIMenuController.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const AIMenuController = (props: {
// We should just be able to set `referencePress: true` instead of
// using this listener, but this doesn't seem to trigger.
// (probably because we don't assign the referenceProps to the reference element)
outsidePress: (event) => {
outsidePress: (event: MouseEvent) => {
if (event.target instanceof Element) {
const blockElement = event.target.closest(".bn-block");
if (
Expand Down
Loading