Skip to content

Improve dnd + embeds - #30

Open
paulsonnentag wants to merge 9 commits into
mainfrom
improve-markdown-dnd
Open

Improve dnd + embeds#30
paulsonnentag wants to merge 9 commits into
mainfrom
improve-markdown-dnd

Conversation

@paulsonnentag

@paulsonnentag paulsonnentag commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Shared embed between tldraw and codemirror

Screenshot 2026-07-28 at 15 11 19

Nicer drag and drop in markdown

  • cursor feedback
  • ensure that embed is placed on a new line
  • make the embed atomic so moving the cursor around in the document doesn't hide the embed
Screenshot 2026-07-28 at 15 07 23

Show a drop cursor while dragging over the editor, and put dropped
embeds on their own line when dropped into a line with content.
New `embed` package (TypeScript + vite) registers an unlisted wildcard
patchwork:tool that renders the embed chrome (live title with rename,
open-with tool picker, open button) around a nested patchwork-view.
codemirror-markdown and tldraw4 now mount it via tool-id="embed" instead
of each hand-rolling the same titlebar, and persist tool picks from its
patchwork:embed-tool-changed event (marker text / shape props).
@paulsonnentag paulsonnentag changed the title Improve dnd of embeds Improve dnd + embeds Jul 28, 2026
@patchcrow

patchcrow commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

✅ Patchwork glance ready

https://patchwork-preview-30--patchwork-base.netlify.app

Patchwork from inkandswitch/patchwork.inkandswitch.com, packages from this PR at 6db6ba2.

build-info.json

Drop the search box (and its filtering, keyboard nav, and forcing of
arbitrary tool ids) in favor of a simple click-to-pick list. When the
host doesn't pin a tool, show the doc's fallback tool as the current
selection instead of a special "Open with..." placeholder state.
Two fixes for the shared embed frame:
- Read embed-tool-id from the outer <patchwork-view> too: tools receive
  the inner <patchwork-view-legacy> element, which never carries the
  attribute, so every remount silently dropped the pinned tool back to
  the fallback.
- Hosts (codemirror widget, tldraw shape) stop propagation of
  patchwork:embed-tool-changed once handled, so a pick inside a nested
  embed no longer also rewrites the outer embed's tool.

Also show the embed package version in the frame header as a deploy
check.
Trim the comments added on this branch down to their load-bearing
content across the embed package, codemirror-markdown, and tldraw4.
Replace the imperative DOM construction and manual re-render calls in
the embed tool with a Solid component: signals for doc/datatype/pinned
tool drive the title, rename input, tool button, and picker menu
reactively. Behavior and CSS are unchanged; solid-js resolves through
the importmap as a bootloader external.
@paulsonnentag
paulsonnentag marked this pull request as ready for review July 28, 2026 14:02
pnpm install never wrote the new workspace project into pnpm-lock.yaml,
so CI's frozen-lockfile install failed. Importer entry written against
the already-pinned snapshots (the subduction sync server that the
patchwork pnpm plugin needs for re-resolving automerge: deps is
currently down, blocking a regular lockfile regeneration); verified
locally with pnpm install --frozen-lockfile passing lockfile validation.
@chee

chee commented Jul 28, 2026

Copy link
Copy Markdown
Member

is copy the right cursor icon for this? i wonder if we'd be better off using setDragImage to make a little infobox by the cursor that says like "embed 1 doc" or something

@paulsonnentag

Copy link
Copy Markdown
Contributor Author

is copy the right cursor icon for this? i wonder if we'd be better off using setDragImage to make a little infobox by the cursor that says like "embed 1 doc" or something

I'll add this

…Effect=link in codemirror and tldraw, tldraw drops get random shape ids instead of url-derived ones
@paulsonnentag

Copy link
Copy Markdown
Contributor Author

I've realized that we can't use setDragImage because we can only make the determination that this should be an embed at the drop site. I'm using now a link action instead of copy:
Screenshot 2026-07-29 at 09 44 20

…reates the nested view imperatively; reword an embed comment
@paulsonnentag
paulsonnentag requested a review from OrionReed July 29, 2026 08:07
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.

3 participants