fix: ensure editor has full width regardless of title/content length
The BlockNote editor container (.bn-container) had no explicit width, so it sized based on content. With short or empty document titles, the editor collapsed to a very small width. Fix: set width: 100% on .bn-container and .bn-editor so the editor always fills available space. Added margin: 0 auto on .bn-editor to keep the 760px text column centered. Also adds an E2E test verifying editor width stays above 300px. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
33
e2e/editor-min-width.spec.ts
Normal file
33
e2e/editor-min-width.spec.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { test, expect } from '@playwright/test'
|
||||
|
||||
test('editor panel has proper width regardless of title length', async ({ page }) => {
|
||||
await page.goto('http://localhost:5204')
|
||||
await page.waitForTimeout(1000)
|
||||
|
||||
// Click on a note with a short title from the note list
|
||||
const noteItems = page.locator('.note-list__item')
|
||||
const count = await noteItems.count()
|
||||
|
||||
if (count > 0) {
|
||||
// Click the first note
|
||||
await noteItems.first().click()
|
||||
await page.waitForTimeout(500)
|
||||
|
||||
// Measure editor container width
|
||||
const editorContainer = page.locator('.editor__blocknote-container')
|
||||
const box = await editorContainer.boundingBox()
|
||||
|
||||
// The editor should have a reasonable width (at least 300px)
|
||||
expect(box).toBeTruthy()
|
||||
expect(box!.width).toBeGreaterThan(300)
|
||||
|
||||
// Screenshot for visual verification
|
||||
await page.screenshot({ path: 'test-results/editor-min-width.png', fullPage: true })
|
||||
|
||||
// Also check that .bn-container fills the editor width
|
||||
const bnContainer = page.locator('.editor__blocknote-container .bn-container')
|
||||
const bnBox = await bnContainer.boundingBox()
|
||||
expect(bnBox).toBeTruthy()
|
||||
expect(bnBox!.width).toBeGreaterThan(300)
|
||||
}
|
||||
})
|
||||
@@ -24,6 +24,7 @@
|
||||
}
|
||||
|
||||
.editor__blocknote-container .bn-container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: var(--bg-primary);
|
||||
color: var(--text-primary);
|
||||
@@ -31,8 +32,10 @@
|
||||
}
|
||||
|
||||
.editor__blocknote-container .bn-editor {
|
||||
width: 100%;
|
||||
padding: 20px 40px;
|
||||
max-width: 760px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
/* =============================================
|
||||
|
||||
Reference in New Issue
Block a user