-
Notifications
You must be signed in to change notification settings - Fork 5k
Add mentions feature to objects in notes #16373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
… pattern to SingleRecordPickerMenu
Welcome!
Hello there, congrats on your first PR! We're excited to have you contributing to this project. |
packages/twenty-front/src/modules/ui/input/editor/hooks/useMentionMenu.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a mentions feature to the BlockNote editor, allowing users to type @ to trigger a dropdown menu for selecting and linking to objects within notes.
Key changes:
- Added
MentionInlineContentto the BlockNote schema for rendering mentioned objects as clickableRecordChipcomponents - Implemented
useMentionMenuhook to fetch and filter searchable object records - Created
CustomMentionMenuandCustomMentionMenuListItemcomponents for the mention selection UI
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
packages/twenty-front/src/modules/ui/input/editor/hooks/useMentionMenu.ts |
Hook that fetches searchable objects and provides mention items for the suggestion menu |
packages/twenty-front/src/modules/ui/input/editor/components/types.ts |
Added MentionItem type definition extending DefaultReactSuggestionItem |
packages/twenty-front/src/modules/ui/input/editor/components/CustomMentionMenuListItem.tsx |
Component rendering individual items in the mention menu dropdown |
packages/twenty-front/src/modules/ui/input/editor/components/CustomMentionMenu.tsx |
Main mention menu component with keyboard navigation and selection support |
packages/twenty-front/src/modules/ui/input/editor/components/BlockEditor.tsx |
Integrated mention menu with @ trigger via SuggestionMenuController |
packages/twenty-front/src/modules/ui/input/constants/MentionMenuListId.ts |
Constant for mention menu selectable list identifier |
packages/twenty-front/src/modules/ui/input/constants/MentionMenuDropdownClickOutsideId.ts |
Constant for mention menu click-outside handling |
packages/twenty-front/src/modules/command-menu/components/CommandMenuOpenContainer.tsx |
Added mention menu dropdown to excluded click-outside IDs |
packages/twenty-front/src/modules/activities/blocks/constants/Schema.ts |
Extended BlockNote schema with mention inline content spec |
packages/twenty-front/src/modules/activities/blocks/components/MentionInlineContent.tsx |
React component that renders mentions as styled RecordChip components |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/twenty-front/src/modules/ui/input/editor/hooks/useMentionMenu.ts
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/ui/input/editor/components/CustomMentionMenu.tsx
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/ui/input/editor/components/CustomMentionMenu.tsx
Show resolved
Hide resolved
Greptile OverviewGreptile SummaryThis PR adds Key changes:
Architecture notes:
Confidence Score: 4/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant BlockEditor
participant SuggestionMenuController
participant useMentionMenu
participant useObjectRecordSearchRecords
participant CustomMentionMenu
participant CustomMentionMenuListItem
participant MentionInlineContent
participant useFindOneRecord
User->>BlockEditor: Types "@"
BlockEditor->>SuggestionMenuController: Trigger "@" character
SuggestionMenuController->>useMentionMenu: getItems(query)
useMentionMenu->>useObjectRecordSearchRecords: searchInput = query
useObjectRecordSearchRecords-->>useMentionMenu: searchRecords[]
useMentionMenu-->>SuggestionMenuController: MentionItem[]
SuggestionMenuController->>CustomMentionMenu: render(items)
CustomMentionMenu->>CustomMentionMenuListItem: render each item
User->>CustomMentionMenuListItem: Clicks item
CustomMentionMenuListItem->>useMentionMenu: onItemClick()
useMentionMenu->>BlockEditor: insertInlineContent(mention)
BlockEditor->>MentionInlineContent: render mention
MentionInlineContent->>useFindOneRecord: fetch record data
useFindOneRecord-->>MentionInlineContent: record
MentionInlineContent-->>User: Display RecordChip
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional Comments (1)
-
packages/twenty-front/src/modules/ui/input/editor/hooks/useMentionMenu.ts, line 69-75 (link)logic: Potential race condition:
setSearchQuery(query)triggers an async state update, butmentionItemsis returned immediately with results from the previous query. On first keystroke, users may see stale/empty results until the next render cycle.
10 files reviewed, 1 comment
|
🚀 Preview Environment Ready! Your preview environment is available at: http://bore.pub:43206 This environment will automatically shut down when the PR is closed or after 5 hours. |
|
@Bonapara is this useful if it doesn't ping the user? I feel it's too early |
|
@charlesBochet I think it’s useful to be able to mention other records in notes, even without notifications, as long as you can mention a team member in v1. (It seems this PR only allows mentioning records from objects that are:
Which seems fine to me. Thanks a lot for raising this PR @acee3! It will bring a lot of value to Twenty. Two main pieces of feedback from a product/design perspective: |
… scrollable container within the external container instead of inside
|
@Bonapara Thanks for your response and feedback! I am a little bit confused about what you mean by using the relation chip component. I wasn't able to find one other than the RecordChip, which I was already using. I assumed you meant that the icon of the object should show, so I made some updates to that. If that is the case, I was able to implement all your changes.
Also, I don't think the failing CI front storybook test about network failure seems to be related to the change I just made. Other people seem to be getting the same exact failing test. |
|
Hi @acee3, yes indeed! For the rest, I couldn’t try your PR yet, as it seems you didn’t take permissions into account:
|
|
Hey @charlesBochet could you please re-review this when you have some freetime please ? |
|
@charlesBochet @prastoin @Bonapara Just checking in if there is anything I need to do to get this merged? |





Issue #15755
Context
As shown in the issue, users should be able to @ objects and have it be linked to their associated page.
Changes Made
Result
Screen.Recording.2025-12-05.at.2.56.34.PM.mov