diff --git a/docs/content/pages/thanks.mdx b/docs/content/pages/thanks.mdx index 94a7a2ba9b..9f9ca6c9f0 100644 --- a/docs/content/pages/thanks.mdx +++ b/docs/content/pages/thanks.mdx @@ -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. diff --git a/packages/ariakit/src/badge/Badge.tsx b/packages/ariakit/src/badge/Badge.tsx index 43b6cdd7d5..f81ca9ce5a 100644 --- a/packages/ariakit/src/badge/Badge.tsx +++ b/packages/ariakit/src/badge/Badge.tsx @@ -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, @@ -36,7 +36,7 @@ export const Badge = forwardRef< isSelected && "bn-ak-primary", )} aria-selected={isSelected === true} - onClick={(event) => onClick?.(event)} + onClick={(event: MouseEvent) => onClick?.(event)} onMouseEnter={onMouseEnter} ref={ref} > diff --git a/packages/ariakit/src/panel/Panel.tsx b/packages/ariakit/src/panel/Panel.tsx index 376f04a534..b988cbec01 100644 --- a/packages/ariakit/src/panel/Panel.tsx +++ b/packages/ariakit/src/panel/Panel.tsx @@ -32,7 +32,7 @@ export const Panel = forwardRef< { + setActiveId={(activeId: string | null | undefined) => { if (activeId) { setOpenTab(activeId); } diff --git a/packages/ariakit/src/panel/PanelFileInput.tsx b/packages/ariakit/src/panel/PanelFileInput.tsx index 4c6a876931..36917ff5a5 100644 --- a/packages/ariakit/src/panel/PanelFileInput.tsx +++ b/packages/ariakit/src/panel/PanelFileInput.tsx @@ -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, @@ -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) => onChange?.(e.target.files![0])} placeholder={placeholder} /> diff --git a/packages/ariakit/src/toolbar/ToolbarButton.tsx b/packages/ariakit/src/toolbar/ToolbarButton.tsx index 0fddcb5905..cb2bf26cca 100644 --- a/packages/ariakit/src/toolbar/ToolbarButton.tsx +++ b/packages/ariakit/src/toolbar/ToolbarButton.tsx @@ -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"]; @@ -46,7 +46,7 @@ export const ToolbarButton = forwardRef( )} // Needed as Safari doesn't focus button elements on mouse down // unlike other browsers. - onMouseDown={(e) => { + onMouseDown={(e: MouseEvent) => { if (isSafari()) { (e.currentTarget as HTMLButtonElement).focus(); } diff --git a/packages/core/src/editor/BlockNoteEditor.test.ts b/packages/core/src/editor/BlockNoteEditor.test.ts index 6a4f5f023e..a6ca022e03 100644 --- a/packages/core/src/editor/BlockNoteEditor.test.ts +++ b/packages/core/src/editor/BlockNoteEditor.test.ts @@ -1,4 +1,4 @@ -import { expect, it } from "vitest"; +import { afterEach, expect, it } from "vitest"; import * as Y from "yjs"; import { @@ -11,8 +11,19 @@ import { BlocksChanged } from "../api/getBlocksChangedByTransaction.js"; /** * @vitest-environment jsdom */ + +const editorsToCleanup: BlockNoteEditor[] = []; + +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"); @@ -20,6 +31,7 @@ it("creates an editor", () => { 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", ); @@ -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", ); @@ -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", }); @@ -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 @@ -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(() => { @@ -143,6 +159,7 @@ it("sets an initial block id when using Y.js", async () => { }, }, }); + editorsToCleanup.push(editor); editor.mount(document.createElement("div")); @@ -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 = []; editor.onBeforeChange(({ getChanges }) => { diff --git a/packages/xl-ai/src/components/AIMenu/AIMenuController.tsx b/packages/xl-ai/src/components/AIMenu/AIMenuController.tsx index 930c317fa6..be8f21f555 100644 --- a/packages/xl-ai/src/components/AIMenu/AIMenuController.tsx +++ b/packages/xl-ai/src/components/AIMenu/AIMenuController.tsx @@ -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 (