Skip to content

Make the video dialog and render honour a text selection - #204

Merged
davior merged 1 commit into
mainfrom
claude/loving-bell-7ndwxs
Oct 7, 2026
Merged

davior merged 1 commit into
mainfrom
claude/loving-bell-7ndwxs

Conversation

@davior

@davior davior commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Problem

Selecting part of a note before opening Export → Video (MP4) was meant to render only the selection (added in #200). It didn't work, for two reasons:

  1. Footer showed the whole note. The dialog's /video/estimate request never sent the selection, so "N segments · N characters to narrate · about Xm" always described the full note.
  2. The render itself was empty. The editor sent the selection as Markdown (getEditorSelectionMarkdown), but the segmenter does json.loads on BlockNote JSON and treats anything else as an empty note. A selected render had only the title card and bumpers, or failed with "This note has no text or media".

Changes

  • EditorView.tsx: sends editor.getSelection().blocks as BlockNote JSON, the same form as the stored note. Diagram rasterising walks the selected blocks directly.
  • videoGen.ts / VideoGenModal.tsx: estimate() takes selectedContent, the estimate re-runs when it changes, and the footer starts with "Selection only ·" when a selection is in effect.
  • schemas.py: VideoRenderRequest.selected_content must be a JSON array of blocks or the request gets a 422, so it can no longer silently render nothing. An empty selection ("" or []) means the whole note.

The selection works at block level, so a partly selected paragraph renders in full. That matches how segments are built.

Testing

  • New backend/tests/test_video_selection.py:
    • estimating a selection gives the same result as a note that holds only those blocks;
    • a selection estimates smaller than the whole note;
    • Markdown or non-array input is refused;
    • an empty selection means the whole note.
  • Backend: 1190 passed. Frontend: tsc --noEmit clean, vitest 204 passed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QiJqUAvLhqbSCdkPRDbh7J


Generated by Claude Code

Selecting part of a note before opening the video export was meant to
render only that part, but two things kept it from working:

- The dialog's estimate request never sent the selection, so the footer
  ("N segments · N characters to narrate · about Xm") always described
  the whole note.
- The editor sent the selection as Markdown, but the segmenter parses
  BlockNote JSON and silently treats anything else as an empty note. A
  selected render therefore had nothing in it beyond the title card and
  bumpers, or failed with "no text or media".

The editor now sends the selected blocks as BlockNote JSON (the same form
as the stored note), the estimate passes them through, and the footer
says "Selection only" when one is in effect. Diagram rasterising walks
the selected blocks directly. The API refuses a selection that is not a
JSON block array rather than rendering it as empty, and an empty one
means the whole note.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QiJqUAvLhqbSCdkPRDbh7J
@davior
davior marked this pull request as ready for review October 7, 2026 01:42
@davior
davior merged commit 6c6f7ac into main Oct 7, 2026
2 checks passed
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