diff --git a/src/frontend/apps/e2e/__tests__/app-impress/config.spec.ts b/src/frontend/apps/e2e/__tests__/app-impress/config.spec.ts index 16f1ffdb..ebb32cce 100644 --- a/src/frontend/apps/e2e/__tests__/app-impress/config.spec.ts +++ b/src/frontend/apps/e2e/__tests__/app-impress/config.spec.ts @@ -93,6 +93,7 @@ test.describe('Config', () => { const fileChooserPromise = page.waitForEvent('filechooser'); + await page.locator('.bn-block-outer').last().fill('Anything'); await page.locator('.bn-block-outer').last().fill('/'); await page.getByText('Resizable image with caption').click(); await page.getByText('Upload image').click(); diff --git a/src/frontend/apps/e2e/__tests__/app-impress/doc-header.spec.ts b/src/frontend/apps/e2e/__tests__/app-impress/doc-header.spec.ts index 37a98764..f2c7d679 100644 --- a/src/frontend/apps/e2e/__tests__/app-impress/doc-header.spec.ts +++ b/src/frontend/apps/e2e/__tests__/app-impress/doc-header.spec.ts @@ -124,7 +124,9 @@ test.describe('Doc Header', () => { .getByRole('heading', { name: 'Top World', level: 2 }) .fill(' '); - await page.getByText('Created at').click(); + await page.getByText('Created at').click({ + delay: 200, + }); await expect( docHeader.getByRole('heading', { name: 'Untitled document', level: 2 }), diff --git a/src/frontend/apps/impress/src/features/docs/doc-editor/components/BlockNoteEditor.tsx b/src/frontend/apps/impress/src/features/docs/doc-editor/components/BlockNoteEditor.tsx index afd7a9fa..ebf96df6 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-editor/components/BlockNoteEditor.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-editor/components/BlockNoteEditor.tsx @@ -10,7 +10,7 @@ import * as Y from 'yjs'; import { Box, TextErrors } from '@/components'; import { useAuthStore } from '@/core/auth'; -import { Doc } from '@/features/docs/doc-management'; +import { Doc, Role, currentDocRole } from '@/features/docs/doc-management'; import { useUploadFile } from '../hook'; import { useHeadings } from '../hook/useHeadings'; @@ -133,7 +133,7 @@ export const BlockNoteEditor = ({ doc, provider }: BlockNoteEditorProps) => { * better to let Blocknote manage, then we update the block with the content. */ useEffect(() => { - if (doc.content) { + if (doc.content || currentDocRole(doc.abilities) !== Role.OWNER) { return; } @@ -143,7 +143,7 @@ export const BlockNoteEditor = ({ doc, provider }: BlockNoteEditorProps) => { content: '', }); }, 100); - }, [editor, doc.content]); + }, [editor, doc.content, doc.abilities]); useEffect(() => { setEditor(editor);