Skip to content

Allow safe removal of in-use media from the Media Bin - #158

Open
gorio wants to merge 2 commits into
CutWire-Studios:mainfrom
gorio:contrib/safe-remove-in-use-media
Open

Allow safe removal of in-use media from the Media Bin#158
gorio wants to merge 2 commits into
CutWire-Studios:mainfrom
gorio:contrib/safe-remove-in-use-media

Conversation

@gorio

@gorio gorio commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR improves media removal from the Media Bin when the selected media is still referenced by timeline clips.

Previously, Drift blocked removal whenever an asset was in use. This change keeps the safe behavior by default, but adds an explicit destructive path after user confirmation.

Changes

  • Allows users to remove media that is currently referenced by timeline clips after explicit confirmation.
  • Displays how many timeline clips will be affected before removal.
  • Removes referenced clips and transitions connected to those clips.
  • Keeps the original source file on disk untouched.
  • Records media + clip removal as a single Undo operation.
  • Keeps the existing safe removeAssets() API unchanged.
  • Adds an explicit removeAssetsAndClips() operation for confirmed destructive removal.
  • Adds contextual Delete / Backspace support in the Media Bin.
  • Delete is scoped to Media Bin keyboard focus, so a highlighted media selection does not steal Delete from the timeline.
  • Supports both single and multi-selected media.
  • Adds Brazilian Portuguese translations for the new confirmation messages.

UX

When an in-use media item is removed, Drift now explains the consequence before continuing.

Example:

This media is used by 2 clips on the timeline. Removing it will also remove those clips and connected transitions. The original file on disk is not deleted.

The user can cancel or explicitly confirm the destructive action.

Safety

The existing removeAssets() behavior remains strict and refuses to remove referenced assets.

The new cascade removal is exposed through a separate API and is only used after the destructive confirmation flow.

Source files are never deleted from disk.

Keyboard behavior

When the Media Bin owns keyboard focus:

  • Delete removes the selected media.
  • Backspace is also supported for macOS keyboards.
  • Multi-selection removes the complete selected set.
  • The same confirmation flow used by the context menu is reused.

When focus returns to the timeline, Delete continues to operate on timeline clips instead of media assets.

Undo

Removing:

  • the media asset,
  • its referenced timeline clips,
  • and related transitions

is stored as one project edit.

A single Undo restores the complete operation.

Testing

  • Built successfully on macOS.
  • Dedicated cascade-removal test passed.
  • EditorState test suite passed.
  • Full project test suite passed: 10/10.
  • Manually verified on macOS:
    • remove unused media
    • remove in-use media
    • cancel destructive confirmation
    • remove video + linked audio references
    • Delete / Backspace from the Media Bin
    • contextual Delete behavior between Media Bin and timeline
    • Undo restoration
    • original source file remains on disk

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.

1 participant