From 60da17e13bb7dfbde074cc7e0a82bd181e1467f2 Mon Sep 17 00:00:00 2001 From: lucaronin Date: Tue, 14 Apr 2026 11:14:49 +0200 Subject: [PATCH] fix: restore blocknote slash menu styling --- src/components/SingleEditorView.tsx | 10 +++- .../blocknote-slash-menu-styling.spec.ts | 49 +++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 tests/smoke/blocknote-slash-menu-styling.spec.ts diff --git a/src/components/SingleEditorView.tsx b/src/components/SingleEditorView.tsx index 29d5c19f..7a688b6f 100644 --- a/src/components/SingleEditorView.tsx +++ b/src/components/SingleEditorView.tsx @@ -26,10 +26,17 @@ type TestTableBlock = { } function SharedContextBlockNoteView(props: React.ComponentProps) { + const { className, theme, ...rest } = props const mantineContext = useContext(MantineContext) + const colorScheme = theme === 'dark' ? 'dark' : 'light' const view = ( - + ) @@ -37,6 +44,7 @@ function SharedContextBlockNoteView(props: React.ComponentProps undefined} > diff --git a/tests/smoke/blocknote-slash-menu-styling.spec.ts b/tests/smoke/blocknote-slash-menu-styling.spec.ts new file mode 100644 index 00000000..c2aabacb --- /dev/null +++ b/tests/smoke/blocknote-slash-menu-styling.spec.ts @@ -0,0 +1,49 @@ +import { test, expect, type Page } from '@playwright/test' +import { createFixtureVaultCopy, openFixtureVault, removeFixtureVaultCopy } from '../helpers/fixtureVault' + +let tempVaultDir: string + +async function openAlphaProject(page: Page) { + await openFixtureVault(page, tempVaultDir) + await page.getByText('Alpha Project', { exact: true }).first().click() + await expect(page.locator('.bn-editor')).toBeVisible({ timeout: 10_000 }) +} + +test.describe('BlockNote slash menu styling', () => { + test.beforeEach(() => { + tempVaultDir = createFixtureVaultCopy() + }) + + test.afterEach(() => { + removeFixtureVaultCopy(tempVaultDir) + }) + + test('slash menu keeps Mantine styling tokens in the editor', async ({ page }) => { + await openAlphaProject(page) + + await page.locator('.bn-editor').click() + await page.keyboard.type('/') + + const menu = page.locator('.bn-suggestion-menu') + await expect(menu).toBeVisible({ timeout: 5_000 }) + + const menuStyles = await menu.evaluate((node) => { + const style = getComputedStyle(node) + return { + backgroundColor: style.backgroundColor, + borderRadius: style.borderRadius, + boxShadow: style.boxShadow, + spacing: style.getPropertyValue('--mantine-spacing-sm').trim(), + radius: style.getPropertyValue('--mantine-radius-default').trim(), + shadow: style.getPropertyValue('--mantine-shadow-md').trim(), + } + }) + + expect(menuStyles.backgroundColor).not.toBe('rgba(0, 0, 0, 0)') + expect(menuStyles.borderRadius).not.toBe('0px') + expect(menuStyles.boxShadow).not.toBe('none') + expect(menuStyles.spacing).not.toBe('') + expect(menuStyles.radius).not.toBe('') + expect(menuStyles.shadow).not.toBe('') + }) +})