Skip to content

ENG-1892 Add 'convert to' node option to right click menu for tldraw shape to allow user to convert shape to node (Obsidian) - #1432

Open
trangdoan982 wants to merge 2 commits into
mainfrom
eng-1892-add-convert-to-node-option-to-right-click-menu-for-tldraw
Open

ENG-1892 Add 'convert to' node option to right click menu for tldraw shape to allow user to convert shape to node (Obsidian)#1432
trangdoan982 wants to merge 2 commits into
mainfrom
eng-1892-add-convert-to-node-option-to-right-click-menu-for-tldraw

Conversation

@trangdoan982

@trangdoan982 trangdoan982 commented Sep 10, 2026

Copy link
Copy Markdown
Member

https://www.loom.com/share/012f47508e87410db4aaa383da36d25d

Reviewer brief

  • Result: the canvas right-click Convert To submenu now appears for geo shapes (labelled rectangles, ellipses, etc.) and note (sticky) shapes, not just text and image. It is gated on the shape actually having text, so an unlabelled rectangle shows nothing.
  • arrow is deliberately excluded — it owns the separate "Relation" submenu
  • Risk or follow-up: a delegated review flagged that createDiscourseNodeShape passes the shape's parent-relative x/y to editor.createShape without a parentId, which treats them as page coordinates. Converting a shape parented to a frame would place the node at the wrong position. This is pre-existing and affects text and image conversions identically, so it is left out of this diff — but sticky notes and labelled rectangles inside frames are common, so this change makes it easier to hit. I did not independently reproduce it. Same for two other pre-existing items: markHistoryStoppingPoint is called after the mutations rather than before, and an image whose asset does not resolve to a vault file converts to an empty-titled node.
Verification

Driven against a running Obsidian over CDP, after confirming the loaded bundle was this branch's build:

Selected shape "Convert To" offered
geo rectangle with a label yes
sticky note with text yes
geo rectangle, no label no
arrow with a label no (unchanged)

Full conversion on a labelled rectangle: submenu listed every configured node type, the modal opened pre-filled with the shape's label, and confirming created the node file, removed the geo shape, and placed the node card at the original x/y.

pnpm install --frozen-lockfile + pnpm ci:validate pass (5/5 tasks, 0 cached). eslint on both changed files reports no errors and no warnings.

Scope check

  • Ran $scope-check against the ENG ticket and final diff.
  • Scope beyond Done When: readonly-mode gating and the allowlist rename came from the delegated review, not the ticket. Otherwise, the ticket's Done When is empty and the parent (FEE-824) specifies only "convert tldraw shape to discourse node (if it has text in it)". The text/image case already shipped, so this change covers the remaining text-bearing shapes. No other behaviour changed; toast copy was generalised off "text" wording.

Local delegated full review

  • Ran a comprehensive review of the entire final diff in a subagent with a fresh context. It confirmed the useValue gate is genuinely reactive to richText edits and cheap (rich-text rendering memoizes per object), that the allowlist matches the tldraw 3.14.2 schema exactly, and that the menu gate and converter dispatch cannot disagree. Its actionable points on this diff are applied in the second commit; the rest are the pre-existing items noted above.

🤖 Generated with Claude Code

trangdoan982 and others added 2 commits September 10, 2026 19:46
Extend the canvas right-click "Convert To" submenu beyond text and image
shapes to geo (labelled rectangles, ellipses, etc.) and note (sticky)
shapes, gated on the shape actually having text.

Menu gating and converter dispatch now share canConvertShapeToNode so
they cannot drift.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…adonly

Rename the allowlist to RICH_TEXT_SHAPE_TYPES so it is obvious that
getShapeText only reads props.richText -- adding a shape that stores its
label elsewhere (arrow, frame) would otherwise silently do nothing.

Also disable the Convert To items in readonly canvases, matching the
Relation items, and note that images are gated at conversion time.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@linear-code

linear-code Bot commented Sep 10, 2026

Copy link
Copy Markdown

ENG-1892

@vercel

vercel Bot commented Sep 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
discourse-graph Skipped Skipped Sep 10, 2026 11:54pm UTC

Request Review

@supabase

supabase Bot commented Sep 10, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project zytfjzqyijgagqxrzbmz because there are no changes detected in packages/database/supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant