Skip to content

✨(frontend) Add "Copy link to block" feature - #2547

Open
AntoLC wants to merge 2 commits into
mainfrom
feat/link-to-block
Open

✨(frontend) Add "Copy link to block" feature#2547
AntoLC wants to merge 2 commits into
mainfrom
feat/link-to-block

Conversation

@AntoLC

@AntoLC AntoLC commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Purpose

We added a new feature that allows users to copy a link to a specific block within the document.
We can copy the link to the block by clicking on the "Copy link to block" button in the block's menu in the document editor.
When the link is pasted in the browser, it will automatically scroll to the block.

Demo

Enregistrement.2026-07-30.160257.mp4

@AntoLC AntoLC self-assigned this Jul 30, 2026
@AntoLC AntoLC added enhancement improve an existing feature frontend feature add a new feature labels Jul 30, 2026
@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Size Change: +1.98 kB (+0.05%)

Total Size: 4.36 MB

📦 View Changed
Filename Size Change
apps/impress/out/_next/static/4fa75714/_buildManifest.js 676 B +676 B (new file) 🆕
apps/impress/out/_next/static/419471e4/_buildManifest.js 0 B -677 B (removed) 🏆
apps/impress/out/_next/static/chunks/5149.js 0 B -23.1 kB (removed) 🏆
apps/impress/out/_next/static/chunks/6409.js 25 kB +25 kB (new file) 🆕

compressed-size-action

@AntoLC
AntoLC force-pushed the feat/link-to-block branch from b05dc92 to 2349aa5 Compare July 30, 2026 13:58
@AntoLC

AntoLC commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

We want to have our own side menu, so we can add more
features to it and display the ui as we want.
The new side menu is called DocsSideMenu
and it will be used in the BlockNoteEditor.
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The document editor now uses a custom side menu with block-link copying, table controls, and deletion. Hash URLs scroll to the target block, including blocks rendered after navigation, and table-of-contents navigation reuses the same scrolling helper. Document saves triggered during unload or navigation use fetch keepalive, while periodic saves remain standard. End-to-end tests cover the side menu and copied-link navigation.

Estimated code review effort: 3 (Moderate) | ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: adding the copy-link-to-block feature.
Description check ✅ Passed The description accurately explains the new block-link copying and auto-scroll behavior.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Fix failing CI checks
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/link-to-block

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@src/frontend/apps/impress/src/features/docs/doc-editor/components/DocsSideMenu/LinkToBlockItem.tsx`:
- Around line 21-24: Both LinkToBlockItem and TableHeaderSeparator duplicate the
hovered-block selector. Create a shared useSideMenuBlock hook that encapsulates
the SideMenuExtension useExtensionState call, then replace the inline selectors
in
src/frontend/apps/impress/src/features/docs/doc-editor/components/DocsSideMenu/LinkToBlockItem.tsx
lines 21-24 and
src/frontend/apps/impress/src/features/docs/doc-editor/components/DocsSideMenu/TableHeaderSeparator.tsx
lines 10-13 with that hook.

In `@src/frontend/apps/impress/src/features/docs/doc-editor/hook/useSaveDoc.tsx`:
- Around line 89-117: Update saveDoc and the onSave keepalive flow so
unload-triggered requests never send an unbounded Y.encodeStateAsUpdate(yDoc)
payload through updateDocContent. Add or reuse a bounded-payload write path for
keepalive saves, and preserve recent edits via the existing local/offline
persistence mechanism when the encoded content exceeds the keepalive limit;
retain the current full-content behavior for non-keepalive saves.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 382f17d5-676b-4f11-89b5-cb1033908501

📥 Commits

Reviewing files that changed from the base of the PR and between eed828d and 2349aa5.

⛔ Files ignored due to path filters (5)
  • src/frontend/apps/impress/src/assets/icons/ui-kit/color.svg is excluded by !**/*.svg
  • src/frontend/apps/impress/src/assets/icons/ui-kit/link.svg is excluded by !**/*.svg
  • src/frontend/apps/impress/src/assets/icons/ui-kit/table-header-column.svg is excluded by !**/*.svg
  • src/frontend/apps/impress/src/assets/icons/ui-kit/table-header-row.svg is excluded by !**/*.svg
  • src/frontend/apps/impress/src/assets/icons/ui-kit/trash.svg is excluded by !**/*.svg
📒 Files selected for processing (11)
  • CHANGELOG.md
  • src/frontend/apps/e2e/__tests__/app-impress/doc-editor.spec.ts
  • src/frontend/apps/impress/src/features/docs/doc-editor/components/BlockNoteEditor.tsx
  • src/frontend/apps/impress/src/features/docs/doc-editor/components/DocsSideMenu/DocsSideMenu.tsx
  • src/frontend/apps/impress/src/features/docs/doc-editor/components/DocsSideMenu/LinkToBlockItem.tsx
  • src/frontend/apps/impress/src/features/docs/doc-editor/components/DocsSideMenu/TableHeaderSeparator.tsx
  • src/frontend/apps/impress/src/features/docs/doc-editor/hook/index.ts
  • src/frontend/apps/impress/src/features/docs/doc-editor/hook/useSaveDoc.tsx
  • src/frontend/apps/impress/src/features/docs/doc-editor/hook/useScrollToBlockAnchor.tsx
  • src/frontend/apps/impress/src/features/docs/doc-management/api/useDocContentUpdate.tsx
  • src/frontend/apps/impress/src/features/docs/doc-table-content/components/Heading.tsx

Comment thread src/frontend/apps/impress/src/features/docs/doc-editor/hook/useSaveDoc.tsx Outdated
@AntoLC
AntoLC force-pushed the feat/link-to-block branch from 2349aa5 to 3a4b8c1 Compare July 30, 2026 14:20
@AntoLC AntoLC linked an issue Jul 30, 2026 that may be closed by this pull request
We added a new feature that allows users to copy
a link to a specific block within the document.
We can copy the link to the block by clicking on
the "Copy link to block" button in the block's menu
in the document editor.
When the link is pasted in the browser, it will
automatically scroll to the block.
@AntoLC
AntoLC force-pushed the feat/link-to-block branch from 3a4b8c1 to fadd616 Compare July 30, 2026 19:44
@AntoLC
AntoLC requested a review from Ovgodd July 31, 2026 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement improve an existing feature feature add a new feature frontend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Link to block

1 participant