From 250b5334170e73eb0127a5c668a8b2305fd2b2f1 Mon Sep 17 00:00:00 2001 From: BOUKERFA Mohamed El Amine Date: Wed, 9 Sep 2026 07:58:14 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8(frontend)=20Scroll=20to=20linked=20bl?= =?UTF-8?q?ock=20when=20read-only?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make the "Copy link to block" scroll for users with Read-only permissions. Signed-off-by: BOUKERFA Mohamed El Amine --- CHANGELOG.md | 1 + .../__tests__/app-impress/doc-editor.spec.ts | 17 ++++++++++++++++- .../doc-editor/components/BlockNoteEditor.tsx | 2 ++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a450f26c..eb4935c8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ and this project adheres to - 🐛(backend) skip session creation for the liveness probe - 🐛(frontend) preserve page titles when adding an emoji #2586 +- 🐛(frontend) scroll to the linked block in read-only documents #2663 - 🐛(frontend) hide the selection highlight on presenter images #2665 - 🐛(y-provider) prevent process crash on malformed websocket frames #2673 - 🐛(docker) pull minio images from quay.io #2675 diff --git a/src/frontend/apps/e2e/__tests__/app-impress/doc-editor.spec.ts b/src/frontend/apps/e2e/__tests__/app-impress/doc-editor.spec.ts index 5e7110970..a72d4e7d6 100644 --- a/src/frontend/apps/e2e/__tests__/app-impress/doc-editor.spec.ts +++ b/src/frontend/apps/e2e/__tests__/app-impress/doc-editor.spec.ts @@ -5,7 +5,7 @@ import cs from 'convert-stream'; import { createDoc, goToGridDoc, verifyDocName } from './utils-common'; import { getEditor, openSuggestionMenu, writeInEditor } from './utils-editor'; -import { updateShareLink } from './utils-share'; +import { connectOtherUserToDoc, updateShareLink } from './utils-share'; import { createRootSubPage, getTreeRow, @@ -744,6 +744,21 @@ test.describe('Doc Editor', () => { await page.goto(clipboardContent); await expect(editor.getByText('First Block')).not.toBeInViewport(); await expect(editor.getByText('My Block')).toBeInViewport(); + + await page.getByRole('button', { name: 'Share' }).click(); + await updateShareLink(page, 'Public', 'Reading'); + + // Check link on read-only view for another user + const { otherPage, cleanup } = await connectOtherUserToDoc({ + browserName, + docUrl: clipboardContent, + withoutSignIn: true, + }); + + await expect(otherPage.getByText('First Block')).not.toBeInViewport(); + await expect(otherPage.getByText('My Block')).toBeInViewport(); + + await cleanup(); }); test('it checks "Equation block" feature', async ({ page, browserName }) => { 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 0aa5eef0f..86f5dff19 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 @@ -419,6 +419,8 @@ export const BlockNoteReader = ({ useHeadings(editor); + useScrollToBlockAnchor(); + return (