ENG-1373: Drag pages onto the canvas to create node shapes#1083
Conversation
Page refs aren't draggable by default, so make them draggable via the existing rm-page-ref observer and route the drag payload through the canvas text-content handler that already turns [[name]] into a discourse-node shape. - Always-on: only the draggable attribute is global; the drag payload and drop handling live in the canvas component, so drags are inert unless a canvas is open. - Custom MIME (application/x-roam-page), not text/plain, so a drag can't leak [[title]] into other blocks or apps. - Guard the existing block-dragstart so dragging a ref doesn't also attach its containing block's UID.
|
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: 014d57e942
ℹ️ 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".
The always-on registration had no matching teardown, so the singleton rm-page-ref observer and the makePageRefDraggable callback survived extension unload/reload. Add a cleanup that unregisters the handler; for users without the overlay/preview/suggestive handlers this empties the set and disconnects the observer.
The first commit only captured spans whose data-link-title lives on the parent element. Query-builder result rows and the discourse-context overlay render page links as <a class="rm-page-ref" data-link-title="..."> with the title on the element itself, which the existing parent-only read missed. Also resolve a dragged block whose text is exactly [[X]] to that discourse node's shape (instead of a gray blck-node) when X is a discourse node. The page-ref branch already does this, so factor out tryCreatePageNodeShape and reuse it from the block-ref path; the heavy page-uid + discourse-node lookup is gated behind a cheap PAGE_REF_REGEX match on the block text. - Read data-link-title on the page-ref element itself, falling back to the parent for span page-refs. - Extract tryCreatePageNodeShape; the boolean return lets callers decide the fallback (default text handler vs. blck-node). - Hoist PAGE_REF_REGEX to module scope next to BLOCK_REF_REGEX usage.
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
https://www.loom.com/share/ab6520fa77ed4b10b045d5c8e39bf444