Repository navigation
fix(admin): make /video open the video picker first, like /image - #3936
Conversation
/video and Video in the add-block menu now open the video picker straight away, and the block is added once a video is chosen. Closing the picker adds nothing. The editor no longer creates empty video blocks, so their dashed empty state and the drop and paste handling that filled them are removed. A block saved without a video shows as unplayable, with Replace and Delete. While a picker is open, the position it inserts at now follows document changes, so an upload that finishes meanwhile can't leave it pointing inside another block.
🦋 Changeset detectedLatest commit: 4bbbf9a The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
docs | 4bbbf9a | Oct 06 2026, 10:25 PM |
🚀 Deploying Preview to Cloudflare 🚀Preview URL: https://noah-video-picker-first.try.emdashcms.com, https://noah-video-picker-first-emdash-playground.emdash-cms.workers.dev (commit 4bbbf9a)This URL reflects your latest Preview deploymentPreview Deployments by commit
|
There was a problem hiding this comment.
This change is the right fix: it makes /video behave like /image and /gallery by opening the picker first and only adding the block once a video is chosen. The approach fits the editor’s existing deferred-insertion pattern and the tests cover the important new paths (picker-from-slash, picker-from-gutter, undo-in-one-step, and position tracking while an upload finishes). I read the diff, the changed files, and traced the picker/deferred-position flow through PortableTextEditor.tsx, VideoNode.tsx, and ImageUploadExtension.ts.
I did not find any logic bugs, regressions in drop/paste handling, authorization, localization, or changeset problems. The only issues are two stale comments left over from the removed empty-block UI that now describe behavior that no longer exists.
There was a problem hiding this comment.
This is the right change: it aligns /video and the gutter Video item with the existing /image and /gallery picker-first behavior, removes the now-orphan empty-block UI, and keeps API-created empty blocks visible as unplayable. The implementation matches the described behavior and the updated tests cover /video insertion, picker cancellation, gutter insertion/undo, and the position-follow behavior during in-flight uploads.
I reviewed the diff, the affected source files (PortableTextEditor.tsx, VideoNode.tsx, ImageUploadExtension.ts), the test changes, and the updated changeset and docs. All user-facing strings remain wrapped in Lingui, RTL-safe utilities are used, and no new logged-out queries or SQL are introduced. The only issue I found is a stale comment in VideoNode.tsx that still refers to the removed empty-block placeholder.
@emdash-cms/admin
@emdash-cms/auth
@emdash-cms/auth-atproto
@emdash-cms/blocks
@emdash-cms/cloudflare
@emdash-cms/contentful-to-portable-text
emdash
create-emdash
@emdash-cms/gutenberg-to-portable-text
@emdash-cms/plugin-cli
@emdash-cms/plugin-test
@emdash-cms/plugin-types
@emdash-cms/registry-client
@emdash-cms/registry-lexicons
@emdash-cms/registry-loader
@emdash-cms/registry-moderation
@emdash-cms/registry-verification
upgrade-emdash
@emdash-cms/sandbox-workerd
@emdash-cms/x402
@emdash-cms/plugin-ai-moderation
@emdash-cms/plugin-atproto
@emdash-cms/plugin-audit-log
@emdash-cms/plugin-color
@emdash-cms/plugin-embeds
@emdash-cms/plugin-field-kit
@emdash-cms/plugin-forms
@emdash-cms/plugin-webhook-notifier
commit: |
The mock insert button now prevents mousedown like the real one, and the tests focus the editor first, so the picker never records the button as the element to return focus to.
Scope checkThis PR changes 669 lines across 7 files. Large PRs are harder to review and more likely to be closed without review. If this scope is intentional, no action needed. A maintainer will review it. If not, please consider splitting this into smaller PRs. See CONTRIBUTING.md for contribution guidelines. |
There was a problem hiding this comment.
The author addressed all prior review findings. The JSDoc at the top of VideoNode.tsx now correctly reads "without asset when it has no video," and the figcaption comment now clarifies that the inline-size containment is for the caption textarea's placeholder text, not the removed dashed empty-block placeholder.
This is still the right change: picker-first /video and gutter Video insertion now behave the same as /image and /gallery. The implementation correctly avoids creating an empty video block, keeps API-created asset-less blocks visible as unplayable in the editor, and preserves the existing drop/paste upload behavior while removing the now-orphan empty-video UI.
I re-checked the new transaction-follow effect that maps pendingBlockInsertPosRef through in-flight uploads, the handleVideoSelect insertion path, the ImageUploadExtension simplification, the updated tests covering picker cancellation, gutter insertion/undo, and the upload-during-picker scenario, plus the updated docs and changeset. All user-facing strings are Lingui-wrapped, layout stays RTL-safe, and no new logged-out queries, database code, or AGENTS.md convention violations were introduced. The updated test suite covers the new behavior and the rewritten assertions match the described semantics.
No blockers remain.
# Conflicts: # .changeset/editor-video-block.md
What does this PR do?
/video, and Video in the add-block menu, now open the video picker straight away. The video block is added once a video is chosen, and closing the picker adds nothing. This is how/imageand/galleryalready work.The "Add a video" guide is updated to match, and a patch changeset for
@emdash-cms/admindescribes the change.Type of change
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpasses (or targeted tests for my change)pnpm formathas been runAI-generated code disclosure
Screenshots / test output
Typing
/videoand pressing Enter opens the video picker. No video block is in the document while it's open:Choosing a video adds the block where
/videowas typed:main(an empty block is added before a video is chosen) and pass here:/videoadds the chosen video.video-block-editor.test.tsxandimage-upload.test.tsxpassed 45/45 tests in each of 20 runs, and in each of 6 runs with the CPU slowed 4×.