From 405b711e160174df928f1d4fd8bd0b7671621082 Mon Sep 17 00:00:00 2001 From: lucaronin Date: Wed, 29 Apr 2026 10:06:03 +0200 Subject: [PATCH] revert: restore editor side menu ordering --- .../tolariaBlockNoteSideMenu.test.tsx | 18 ++++-------------- src/components/tolariaBlockNoteSideMenu.tsx | 9 +-------- tests/smoke/editor-block-reorder.spec.ts | 7 +++---- 3 files changed, 8 insertions(+), 26 deletions(-) diff --git a/src/components/tolariaBlockNoteSideMenu.test.tsx b/src/components/tolariaBlockNoteSideMenu.test.tsx index 4e9782fa..9facdb75 100644 --- a/src/components/tolariaBlockNoteSideMenu.test.tsx +++ b/src/components/tolariaBlockNoteSideMenu.test.tsx @@ -6,20 +6,14 @@ import { TolariaSideMenu } from './tolariaBlockNoteSideMenu' let capturedDragHandleMenu: ComponentType | null = null vi.mock('@blocknote/react', () => ({ - AddBlockButton: () => , DragHandleMenu: ({ children }: PropsWithChildren) => (
{children}
), - DragHandleButton: ({ dragHandleMenu }: { dragHandleMenu?: ComponentType }) => { - capturedDragHandleMenu = dragHandleMenu ?? null - return ( - - ) - }, RemoveBlockItem: ({ children }: PropsWithChildren) =>
{children}
, - SideMenu: ({ children }: PropsWithChildren) =>
{children}
, + SideMenu: ({ dragHandleMenu }: { dragHandleMenu?: ComponentType }) => { + capturedDragHandleMenu = dragHandleMenu ?? null + return
+ }, TableColumnHeaderItem: ({ children }: PropsWithChildren) =>
{children}
, TableRowHeaderItem: ({ children }: PropsWithChildren) =>
{children}
, useDictionary: () => ({ @@ -38,10 +32,6 @@ describe('TolariaSideMenu', () => { expect(screen.getByTestId('side-menu')).toBeInTheDocument() expect(capturedDragHandleMenu).not.toBeNull() - expect(screen.getAllByRole('button').map((button) => button.textContent)).toEqual([ - 'Open block menu', - 'Add block', - ]) const DragHandleMenuComponent = capturedDragHandleMenu! render() diff --git a/src/components/tolariaBlockNoteSideMenu.tsx b/src/components/tolariaBlockNoteSideMenu.tsx index 568d0796..2c132ecd 100644 --- a/src/components/tolariaBlockNoteSideMenu.tsx +++ b/src/components/tolariaBlockNoteSideMenu.tsx @@ -1,7 +1,5 @@ import { - AddBlockButton, DragHandleMenu, - DragHandleButton, RemoveBlockItem, SideMenu, TableColumnHeaderItem, @@ -23,10 +21,5 @@ function TolariaDragHandleMenu() { } export function TolariaSideMenu(props: SideMenuProps) { - return ( - - - - - ) + return } diff --git a/tests/smoke/editor-block-reorder.spec.ts b/tests/smoke/editor-block-reorder.spec.ts index bd692994..d32420b2 100644 --- a/tests/smoke/editor-block-reorder.spec.ts +++ b/tests/smoke/editor-block-reorder.spec.ts @@ -19,11 +19,10 @@ async function blockOuterForText(page: Page, text: string): Promise { return textNode.locator('xpath=ancestor::*[contains(concat(" ", normalize-space(@class), " "), " bn-block-outer ")][1]') } -async function visibleLeftBlockHandle(page: Page, block: Locator): Promise { +async function visibleDragHandle(page: Page, block: Locator): Promise { await block.hover() - const handle = page.locator('.bn-side-menu button').first() + const handle = page.locator('.bn-side-menu [draggable="true"]').first() await expect(handle).toBeVisible({ timeout: 5_000 }) - await expect(handle).toHaveAttribute('draggable', 'true') return handle } @@ -60,7 +59,7 @@ test('dragging the left block handle reorders editor blocks', async ({ page }) = await expect.poll(async () => editor.textContent()).toMatch(/Alpha Project[\s\S]*This is a test project[\s\S]*Notes/) - const handle = await visibleLeftBlockHandle(page, notesHeading) + const handle = await visibleDragHandle(page, notesHeading) await dragHandleToBlock(page, handle, paragraph) await expect.poll(async () => editor.textContent()).toMatch(/Alpha Project[\s\S]*Notes[\s\S]*This is a test project/)