[ENG-2088] Add tag to block button on canvas block cards - #1351
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4e691ad18a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| <NodeMenu | ||
| key={addTagMenuKey} | ||
| blockUid={shape.props.uid} | ||
| extensionAPI={extensionAPI} | ||
| onClose={() => setAddTagMenuKey((k) => k + 1)} | ||
| onTagAdded={handleTagAdded} |
There was a problem hiding this comment.
Add unit coverage for the canvas tag flow
Add meaningful unit tests covering tag selection, the asynchronous block update, and the subsequent shape title/size refresh; this commit introduces that behavior without any tests, so regressions such as a rejected update or stale shape state will not be detected.
AGENTS.md reference: AGENTS.md:L82-L85
Useful? React with 👍 / 👎.
|
|
||
| {/* Add Tag to Block Button */} | ||
| {extensionAPI && showAddTagButton && ( | ||
| <NodeMenu |
There was a problem hiding this comment.
Mount the tag menu only when a card opens it
On canvases with many live block cards, this mounts a separate NodeMenu for every card even while all menus are closed. Each instance reads and parses all discourse nodes and, because it has a trigger, registers its own keydown and keyup listeners on document; consequently initialization and every keyboard event scale with the number of mounted cards. Lazily mounting the menu after the trigger is activated, or sharing one menu among cards, avoids that canvas-wide overhead.
Useful? React with 👍 / 👎.
Adds a
# Add tagbutton to the header of block cards on the Roam canvas, per the DES-359 mock. It reusesNodeMenuin tag mode, so selecting a tag appends it to the end of the block text; a new optionalonTagAddedcallback onNodeMenulets the shape update its own props (title + recalculated size) after the write, since nothing on the canvas watches block strings. The header buttons (sidebar, add tag, convert) now sit in one flex container instead of fixed absolute offsets — the large Convert-button hunk is indentation-only (git diff -w). The button only shows on live block shapes when at least one node type has a tag configured, and the key-remount on close mirrorsrenderImageToolsMenu.Known limitation, left out of scope: each block card mounts a trigger-mode
NodeMenu, which attaches document-level key listeners that no-op unless that menu is open; avoiding that would change sharedNodeMenubehavior that the textarea flows depend on.