Make slide text easy to copy: no nav on selection + 'c' copies slide markdown#37
Conversation
A click on the slide body advances to the next slide. Previously this fired even at the end of a text-selection drag, so highlighting text to copy it would also jump to the next slide. Track the pointer-down position and skip navigation on click when either: - the pointer moved more than a small threshold between down and up (a drag, i.e. a highlight gesture), or - there is a live non-empty text selection (e.g. double-click word select). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c308dcd25e
ℹ️ 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".
| const selection = window.getSelection(); | ||
| if (selection && !selection.isCollapsed && selection.toString().trim()) return; |
There was a problem hiding this comment.
Preserve double-click text selection before advancing
When a user double-clicks a word to select/copy it, the first click event has no drag distance and no live selection yet, so these guards fall through and call next()/prev() before the second click can create the selection. This means the double-click selection case still changes slides instead of selecting text; consider detecting multi-clicks (e.detail) or otherwise deferring single-click navigation long enough to distinguish it.
Useful? React with 👍 / 👎.
Add a "copy current slide as markdown" affordance: each slide's markdown source is embedded in its <section> (base64 of UTF-8, avoiding HTML and unicode escaping pitfalls), and pressing 'c' copies it to the clipboard with a toast confirmation. Cmd/Ctrl+C is left alone so selected text still copies normally. Falls back to execCommand for insecure contexts. Also address PR review: skip navigation on multi-click (e.detail > 1) so double/triple-click word/paragraph selection doesn't advance on the later clicks. The first click of a double-click can't be distinguished without deferring all navigation, which we avoid to keep slide clicks snappy. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
What
Two related improvements for getting text/content out of slides:
cto copy the current slide's markdown source to the clipboard, with a small toast confirmation.How
Selection guard (
_bindClick): record the pointer-down position onmousedown; onclickskip navigation when the pointer moved >8px (a drag), when there's a live non-empty selection, or on a multi-click (e.detail > 1, i.e. double/triple-click word/paragraph select). A plain click still advances exactly as before.Copy as markdown: at build time each slide's
to_markdown()source is embedded in its<section>asdata-colloquium-md(base64 of UTF-8 — sidesteps HTML-escaping and unicode pitfalls). Pressing plaincdecodes it and writes to the clipboard via the async Clipboard API, with anexecCommandtextarea fallback for insecure contexts (file://).Cmd/Ctrl+Cis deliberately left alone so selecting and copying text still works. The toast is hidden in capture mode.Note on double-click (review feedback)
The first click of a double-click can't be distinguished from a navigation click without deferring all single-click navigation ~250ms, which would make clicking through slides feel laggy. Since drag-to-select (the common copy gesture) is fully handled and
e.detailblocks the later clicks of a multi-click, we accept that the very first click of a double-click may still advance rather than degrade the primary interaction.Testing
233 passed, 1 skipped;node -csyntax check + example build passCmd+Ccopy text without nav;ccopies slide markdown with toast🤖 Generated with Claude Code