Skip to content

Seat a draft's Copy through its toolbar declaration, and delete copyBlock - #6141

Merged
max-sixty merged 2 commits into
mainfrom
code-comments-look
Nov 16, 2026
Merged

max-sixty merged 2 commits into
mainfrom
code-comments-look

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

A draft now hands Leaf its Copy the same way lf-code does since #6109: it marks itself data-lf-copy="Markdown", returns its source from lfCopy(), and names its toolbar as lfBar, so Leaf stands Copy last in that toolbar. Nothing calls copyBlock after that, so it goes from code-copy.js, the public package API (widget-api.js) and module-reading.md, leaving one route for a widget to place Copy. The draft's toolbar is unchanged on base and head: Edit and Copy at rest, Save, Discard and Copy while editing (checked with leaf-dev probe --base).

HTMLElement.lfCopy and lfBar now admit undefined, as lfCommands does, so a widget can assign them on itself under exactOptionalPropertyTypes.

The Copy journey in tests/journeys/test_render_anchors.py was left failing by #6109: its lf-code had a note, which now seats Copy in the notes toolbar instead of after the block. Its note goes, so it keeps checking the after-the-block seat, and the notes toolbar test now presses Copy and checks the clipboard holds the code without the note's words.

Max asked for this as the follow-up to #6109. Tests: the draft editing and sending tests that press Copy or its toolbar, the Copy journey, the code-reading tests, pnpm run test:runtime and pnpm run check:browser.

This was written by Claude Code on behalf of max-sixty

…lock

A draft now declares its Markdown the way lf-code declares its code: `data-lf-copy`,
`lfCopy()`, and `lfBar` naming the toolbar Leaf stands Copy last in. That leaves
`copyBlock` with no caller, so the second route to the same control goes from the
runtime, the public package API and module-reading.md. The draft's toolbar is
unchanged: Edit and Copy at rest, Save, Discard and Copy while editing.

The Copy journey in tests/journeys/test_render_anchors.py drops its lf-code's note:
since #6109 a block with notes seats Copy in its notes toolbar, so the note had moved
the control the journey checks out of the after-the-block seat. The notes toolbar test
now presses Copy there and checks the clipboard holds the code without the note.
@max-sixty
max-sixty merged commit 69005f9 into main Nov 16, 2026
5 checks passed
@max-sixty
max-sixty deleted the code-comments-look branch November 16, 2026 08:36
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.

2 participants