Skip to content

🎥 Make videos programmatically with React

`@remotion/studio`: Add image previews and asset URL replacement (#11303)

Igor Samokhovetsaf9482c57b2b
diff --git a/packages/studio-shared/src/schema-field-info.ts b/packages/studio-shared/src/schema-field-info.ts
index 0fab987f25..a54c2c23a7 100644
--- a/packages/studio-shared/src/schema-field-info.ts
+++ b/packages/studio-shared/src/schema-field-info.ts
@@ -289,6 +289,10 @@ const getSchemaFieldRowHeight = ({
);
}
+ if (fieldSchema.type === 'asset' && fieldSchema.assetType === 'image') {
+ return 56;
+ }
+
return SCHEMA_FIELD_ROW_HEIGHT;
};
diff --git a/packages/studio/src/components/AssetSelectorModal.tsx b/packages/studio/src/components/AssetSelectorModal.tsx
new file mode 100644
index 0000000000..fbc3644e9d
--- /dev/null
+++ b/packages/studio/src/components/AssetSelectorModal.tsx
@@ -0,0 +1,281 @@
+import React, {
+ useCallback,
+ useContext,
+ useEffect,
+ useMemo,
+ useState,
+} from 'react';
+import {FAIL_COLOR, LIGHT_TEXT} from '../helpers/colors';
+import {
+ type AssetSelectionModalState,
+ SetSelectedModalContext,
+} from '../state/modals';
+import {Button} from './Button';
+import {Row, Spacing} from './layout';
+import {ModalButton} from './ModalButton';
+import {ModalContainer} from './ModalContainer';
+import {ModalFooterContainer} from './ModalFooter';
+import {ModalHeader} from './ModalHeader';
+import {RemotionInput} from './NewComposition/RemInput';
+import {QuickSwitcherContent} from './QuickSwitcher/QuickSwitcherContent';
+import type {SegmentedControlItem} from './SegmentedControl';
+import {SegmentedControl} from './SegmentedControl';
+
+const panel: React.CSSProperties = {
+ maxWidth: 'calc(100vw - 40px)',
+ overflow: 'hidden',
+ width: 400,
+};
+
+const sourceSelector: React.CSSProperties = {
+ display: 'flex',
+ padding: '12px 16px 0',
+};
+
+const urlContent: React.CSSProperties = {
+ boxSizing: 'border-box',
+ minHeight: 300,
+ padding: 16,
+};
+
+const compactUrlContent: React.CSSProperties = {
+ boxSizing: 'border-box',
+ padding: 16,
+};
+
+const label: React.CSSProperties = {
+ color: LIGHT_TEXT,
+ display: 'block',
+ fontFamily: 'sans-serif',
+ fontSize: 12,
+ marginBottom: 8,
+};
+
+const previewRow: React.CSSProperties = {
+ alignItems: 'center',
+ display: 'flex',
+ gap: 16,
+ minHeight: 112,
+ paddingTop: 16,
+};
+
+const previewImage: React.CSSProperties = {
+ display: 'block',
+ height: 96,
+ objectFit: 'contain',
+ width: 96,
+};
+
+const previewStatus: React.CSSProperties = {
+ color: LIGHT_TEXT,
+ fontFamily: 'sans-serif',
+ fontSize: 12,
+ lineHeight: 1.5,
+};
+
+const footer: React.CSSProperties = {
+ display: 'flex',
+ minWidth: 0,
+ width: '100%',
+};
+
+const isHttpUrl = (value: string) => {
+ try {
+ const {protocol} = new URL(
+ value.startsWith('//') ? `https:${value}` : value,
+ );
+ return protocol === 'http:' || protocol === 'https:';
+ } catch {
+ return false;
+ }
+};
+
+type PreviewState =
+ | {type: 'empty'}
+ | {type: 'invalid'}
+ | {type: 'loading'}
+ | {type: 'loaded'; width: number; height: number}
+ | {type: 'error'};
+
+export const AssetSelectorModal: React.FC<{
+ readonly state: AssetSelectionModalState;
+ readonly readOnlyStudio: boolean;
+}> = ({state, readOnlyStudio}) => {
+ const {setSelectedModal} = useContext(SetSelectedModalContext);
+ const [mode, setMode] = useState<'project' | 'url'>(() =>
+ state.initialUrl === null ? 'project' : 'url',
+ );
+ const [draft, setDraft] = useState(state.initialUrl ?? '');
+ const [previewState, setPreviewState] = useState<PreviewState>(() =>
+ state.assetType === 'image' && state.initialUrl !== null
+ ? {type: 'loading'}
+ : {type: 'empty'},
+ );
+
+ const close = useCallback(() => {
+ setSelectedModal(null);
+ }, [setSelectedModal]);
+
+ useEffect(() => {
+ if (state.assetType !== 'image') {
+ setPreviewState({type: 'empty'});
+ return;
+ }
+
+ const value = draft.trim();
+ if (value === '') {
+ setPreviewState({type: 'empty'});
+ return;
+ }
+
+ if (!isHttpUrl(value)) {
+ setPreviewState({type: 'invalid'});
+ return;
+ }
+
+ let cancelled = false;
+ const image = new Image();
+ setPreviewState({type: 'loading'});
+ image.onload = () => {
+ if (!cancelled) {
+ setPreviewState({
+ type: 'loaded',
+ width: image.naturalWidth,
+ height: image.naturalHeight,
+ });
+ }
+ };
+
+ image.onerror = () => {
+ if (!cancelled) {
+ setPreviewState({type: 'error'});
+ }
+ };
+
+ image.src = value.startsWith('//') ? `https:${value}` : value;
+
+ return () => {
+ cancelled = true;
+ image.onload = null;
+ image.onerror = null;
+ };
+ }, [draft, state.assetType]);
+
+ const items = useMemo<SegmentedControlItem[]>(
+ () => [
+ {
+ key: 'project',
+ label: 'Project assets',
+ onClick: () => setMode('project'),
+ selected: mode === 'project',
+ },
+ {
+ key: 'url',
+ label: 'URL',
+ onClick: () => setMode('url'),
+ selected: mode === 'url',
+ },
+ ],
+ [mode],
+ );
+ const trimmedDraft = draft.trim();
+ const canApply = isHttpUrl(trimmedDraft);
+ const invalidDraft = trimmedDraft !== '' && !canApply;
+ const apply = useCallback(() => {
+ if (!canApply) {
+ return;
+ }
+
+ state.onSelectedUrl(trimmedDraft);
+ close();
+ }, [canApply, close, state, trimmedDraft]);
+ const onSubmit = useCallback<React.FormEventHandler<HTMLFormElement>>(
+ (event) => {
+ event.preventDefault();
+ apply();
+ },
+ [apply],
+ );
+
+ const assetTypeLabel =
+ state.assetType.charAt(0).toUpperCase() + state.assetType.slice(1);
+
+ return (
+ <ModalContainer onEscape={close} onOutsideClick={close} panelStyle={panel}>
+ <ModalHeader title={`Replace ${state.assetType}`} onClose={close} />
+ <div style={sourceSelector}>
+ <SegmentedControl items={items} needsWrapping={false} size="compact" />
+ </div>
+ {mode === 'project' ? (
+ <QuickSwitcherContent
+ assetSelection={state.assetSelection}
+ compositionSelection={null}
+ initialMode="assets"
+ invocationTimestamp={state.invocationTimestamp}
+ readOnlyStudio={readOnlyStudio}
+ />
+ ) : (
+ <form onSubmit={onSubmit}>
+ <div
+ style={state.assetType === 'image' ? urlContent : compactUrlContent}
+ >
+ <label htmlFor="remotion-asset-url" style={label}>
+ {assetTypeLabel} URL
+ </label>
+ <RemotionInput
+ id="remotion-asset-url"
+ autoFocus
+ onChange={(event) => setDraft(event.target.value)}
+ placeholder={`https://example.com/${state.assetType}`}
+ rightAlign={false}
+ status={invalidDraft ? 'error' : 'ok'}
+ type="url"
+ value={draft}
+ />
+ {state.assetType === 'image' ? (
+ <div style={previewRow} role="status">
+ {previewState.type === 'loaded' ? (
+ <img
+ alt="Image URL preview"
+ src={
+ trimmedDraft.startsWith('//')
+ ? `https:${trimmedDraft}`
+ : trimmedDraft
+ }
+ style={previewImage}
+ />
+ ) : null}
+ <div
+ style={
+ previewState.type === 'error'
+ ? {...previewStatus, color: FAIL_COLOR}
+ : previewStatus
+ }
+ >
+ {previewState.type === 'empty'
+ ? 'Enter an image URL.'
+ : previewState.type === 'invalid'
+ ? 'Enter an HTTP(S) URL.'
+ : previewState.type === 'loading'
+ ? 'Loading preview…'
+ : previewState.type === 'error'
+ ? 'Preview unavailable. You can still replace the source.'
+ : `${previewState.width} × ${previewState.height}`}
+ </div>
+ </div>
+ ) : null}
+ </div>
+ <ModalFooterContainer style={footer}>
+ <Row align="center" flex={1} justify="flex-end">
+ <Button onClick={close}>Cancel</Button>
+ <Spacing x={1} />
+ <ModalButton disabled={!canApply} onClick={apply}>
+ Replace {state.assetType}
+ </ModalButton>
+ </Row>
+ </ModalFooterContainer>
+ </form>
+ )}
+ </ModalContainer>
+ );
+};
diff --git a/packages/studio/src/components/Modals.tsx b/packages/studio/src/components/Modals.tsx
index bf19c856d3..df58949441 100644
--- a/packages/studio/src/components/Modals.tsx
+++ b/packages/studio/src/components/Modals.tsx
@@ -4,6 +4,7 @@ import {StudioServerConnectionCtx} from '../helpers/client-id';
import {getStudioAskAIEnabled} from '../helpers/studio-runtime-config';
import {SelectedModalContext, SetSelectedModalContext} from '../state/modals';
import {AskAiModal} from './AskAiModal';
+import {AssetSelectorModal} from './AssetSelectorModal';
import {callApi} from './call-api';
import {ConfirmationDialog, useConfirmationDialog} from './ConfirmationDialog';
import {EffectPickerModal} from './EffectPickerModal';
@@ -280,6 +281,12 @@ export const Modals: React.FC<{
compositionSelection={modalContextType.compositionSelection}
/>
)}
+ {modalContextType && modalContextType.type === 'asset-selection' ? (
+ <AssetSelectorModal
+ readOnlyStudio={readOnlyStudio}
+ state={modalContextType}
+ />
+ ) : null}
{modalContextType && modalContextType.type === 'element-library' && (
<ElementLibraryModal
name={modalContextType.name}
diff --git a/packages/studio/src/components/QuickSwitcher/QuickSwitcherContent.tsx b/packages/studio/src/components/QuickSwitcher/QuickSwitcherContent.tsx
index a633ba252e..815d8c826a 100644
--- a/packages/studio/src/components/QuickSwitcher/QuickSwitcherContent.tsx
+++ b/packages/studio/src/components/QuickSwitcher/QuickSwitcherContent.tsx
@@ -283,7 +283,7 @@ export const QuickSwitcherContent: React.FC<{
return [
{
id: 'select-file',
- title: 'Select file...',
+ title: 'Import file...',
type: 'select-file',
onSelected: () => {
assetSelection.onSelectFile();
diff --git a/packages/studio/src/components/Timeline/TimelineAssetField.tsx b/packages/studio/src/components/Timeline/TimelineAssetField.tsx
index 2618011098..c53f04c6ef 100644
--- a/packages/studio/src/components/Timeline/TimelineAssetField.tsx
+++ b/packages/studio/src/components/Timeline/TimelineAssetField.tsx
@@ -2,6 +2,12 @@ import React, {createContext, useCallback, useContext, useMemo} from 'react';
import {staticFile, type CanUpdateSequencePropStatusStatic} from 'remotion';
import {NoReactInternals} from 'remotion/no-react';
import {writeStaticFile} from '../../api/write-static-file';
+import {LIGHT_TEXT, TRANSPARENT, WHITE} from '../../helpers/colors';
+import {
+ FOCUS_VISIBLE_ONLY_CLASS_NAME,
+ HOVERABLE_CLASS_NAME,
+ hoverableStyle,
+} from '../../helpers/hoverable';
import type {
SchemaFieldInfo,
TimelineFieldOnDragValueChange,
@@ -17,6 +23,7 @@ import {
} from '../InspectorPanel/common';
import {showNotification} from '../Notifications/NotificationCenter';
import {useStaticFiles} from '../use-static-files';
+import {getTimelineAssetLinkInfo} from './timeline-asset-link';
const penIcon: React.CSSProperties = {
display: 'block',
@@ -46,6 +53,78 @@ const assetTypeToAccept = {
image: 'image/*',
} as const;
+const imageAssetField: React.CSSProperties = {
+ alignItems: 'center',
+ display: 'flex',
+ flex: 1,
+ gap: 8,
+ minWidth: 0,
+ padding: '4px 12px',
+};
+
+const thumbnailButton: React.CSSProperties = {
+ ...hoverableStyle({
+ idleBackground: TRANSPARENT,
+ hoverBackground: TRANSPARENT,
+ idleColor: LIGHT_TEXT,
+ hoverColor: WHITE,
+ }),
+ appearance: 'none',
+ border: 'none',
+ cursor: 'default',
+ flexShrink: 0,
+ height: 40,
+ margin: 0,
+ padding: 0,
+ width: 40,
+};
+
+const thumbnail: React.CSSProperties = {
+ display: 'block',
+ height: '100%',
+ objectFit: 'contain',
+ width: '100%',
+};
+
+const imageAssetInfo: React.CSSProperties = {
+ ...hoverableStyle({
+ idleBackground: TRANSPARENT,
+ hoverBackground: TRANSPARENT,
+ idleColor: LIGHT_TEXT,
+ hoverColor: WHITE,
+ }),
+ appearance: 'none',
+ border: 'none',
+ display: 'flex',
+ flex: 1,
+ flexDirection: 'column',
+ gap: 2,
+ margin: 0,
+ minWidth: 0,
+ padding: 0,
+ textAlign: 'left',
+};
+
+const imageAssetName: React.CSSProperties = {
+ color: WHITE,
+ fontFamily: 'sans-serif',
+ fontSize: 12,
+ lineHeight: '16px',
+ overflow: 'hidden',
+ textOverflow: 'ellipsis',
+ whiteSpace: 'nowrap',
+};
+
+const imageAssetSource: React.CSSProperties = {
+ color: LIGHT_TEXT,
+ fontFamily: 'sans-serif',
+ fontSize: 11,
+ lineHeight: '14px',
+ overflow: 'hidden',
+ textOverflow: 'ellipsis',
+ whiteSpace: 'nowrap',
+};
+
export type InspectorSourceAction = InspectorQuickActionProps;
type AssetSelectionContextValue = {
@@ -114,6 +193,20 @@ export const TimelineAssetField: React.FC<TimelineAssetFieldProps> = ({
[propStatus.codeValue, onDragValueChange, onSave, onDragEnd],
);
+ const onSelectUrl = useCallback(
+ (url: string) => {
+ if (url === propStatus.codeValue) {
+ return;
+ }
+
+ onDragValueChange(url);
+ onSave(url).finally(() => {
+ onDragEnd();
+ });
+ },
+ [propStatus.codeValue, onDragValueChange, onDragEnd, onSave],
+ );
+
const selectFile = useCallback(async () => {
const [file] = await pickFilesToImport({
multiple: false,
@@ -157,20 +250,47 @@ export const TimelineAssetField: React.FC<TimelineAssetFieldProps> = ({
}, [assetType, onSelect, staticFiles]);
const openAssetSelection = useCallback(() => {
+ const assetSelection = {
+ initialQuery,
+ onSelectFile: () => {
+ selectFile().catch(() => undefined);
+ },
+ onSelected: (asset: {name: string; src: string}) =>
+ onSelect(asset.name, asset.src),
+ };
+
+ if (assetType !== undefined) {
+ const linkInfo =
+ typeof effectiveValue === 'string'
+ ? getTimelineAssetLinkInfo(effectiveValue)
+ : null;
+ setSelectedModal({
+ type: 'asset-selection',
+ assetType,
+ initialUrl: linkInfo?.kind === 'remote' ? linkInfo.href : null,
+ invocationTimestamp: Date.now(),
+ assetSelection,
+ onSelectedUrl: onSelectUrl,
+ });
+ return;
+ }
+
setSelectedModal({
type: 'quick-switcher',
mode: 'assets',
invocationTimestamp: Date.now(),
- assetSelection: {
- initialQuery,
- onSelectFile: () => {
- selectFile().catch(() => undefined);
- },
- onSelected: (asset) => onSelect(asset.name, asset.src),
- },
+ assetSelection,
compositionSelection: null,
});
- }, [initialQuery, onSelect, selectFile, setSelectedModal]);
+ }, [
+ assetType,
+ effectiveValue,
+ initialQuery,
+ onSelect,
+ onSelectUrl,
+ selectFile,
+ setSelectedModal,
+ ]);
const action = (
<InlineAction
@@ -182,6 +302,64 @@ export const TimelineAssetField: React.FC<TimelineAssetFieldProps> = ({
/>
);
+ if (assetType === 'image' && typeof effectiveValue === 'string') {
+ const linkInfo = getTimelineAssetLinkInfo(effectiveValue);
+ if (linkInfo !== null) {
+ let name: string;
+ let source: string;
+ let previewSrc: string;
+ if (linkInfo.kind === 'local') {
+ name = linkInfo.assetPath.split('/').pop() ?? linkInfo.assetPath;
+ source = 'Project asset';
+ previewSrc = staticFile(linkInfo.assetPath);
+ } else {
+ previewSrc = linkInfo.href.startsWith('//')
+ ? `https:${linkInfo.href}`
+ : linkInfo.href;
+ try {
+ const url = new URL(previewSrc);
+ const encodedName = url.pathname.split('/').filter(Boolean).pop();
+ name = encodedName ? decodeURIComponent(encodedName) : url.hostname;
+ source = url.hostname;
+ } catch {
+ name = 'Remote image';
+ source = linkInfo.href;
+ }
+ }
+
+ const title = inlineSourceAction?.title ?? linkInfo.title;
+
+ return (
+ <div style={imageAssetField}>
+ <button
+ aria-label={`Replace ${name}`}
+ className={`${HOVERABLE_CLASS_NAME} ${FOCUS_VISIBLE_ONLY_CLASS_NAME}`}
+ disabled={window.remotion_isReadOnlyStudio}
+ onClick={openAssetSelection}
+ style={thumbnailButton}
+ title={title}
+ type="button"
+ >
+ <img alt="" src={previewSrc} style={thumbnail} />
+ </button>
+ <button
+ aria-label={`Replace ${name}`}
+ className={`${HOVERABLE_CLASS_NAME} ${FOCUS_VISIBLE_ONLY_CLASS_NAME}`}
+ disabled={window.remotion_isReadOnlyStudio}
+ onClick={openAssetSelection}
+ style={imageAssetInfo}
+ title={title}
+ type="button"
+ >
+ <span style={imageAssetName}>{name}</span>
+ <span style={imageAssetSource}>{source}</span>
+ </button>
+ {action}
+ </div>
+ );
+ }
+ }
+
if (inlineSourceAction === null) {
return action;
}
@@ -190,6 +368,16 @@ export const TimelineAssetField: React.FC<TimelineAssetFieldProps> = ({
<div style={sourceActions}>
<InspectorQuickAction
{...inlineSourceAction}
+ disabled={
+ assetType === undefined
+ ? inlineSourceAction.disabled
+ : window.remotion_isReadOnlyStudio
+ }
+ onClick={
+ assetType === undefined
+ ? inlineSourceAction.onClick
+ : openAssetSelection
+ }
size="compact"
style={standaloneSourceActionStyle}
/>
diff --git a/packages/studio/src/state/modals.ts b/packages/studio/src/state/modals.ts
index e5954ead73..c62049c885 100644
--- a/packages/studio/src/state/modals.ts
+++ b/packages/studio/src/state/modals.ts
@@ -140,6 +140,19 @@ export type AddEffectModalState = {
clientId: string;
};
+export type AssetSelectionModalState = {
+ readonly type: 'asset-selection';
+ readonly assetType: 'audio' | 'video' | 'image';
+ readonly initialUrl: string | null;
+ readonly invocationTimestamp: number;
+ readonly assetSelection: {
+ readonly initialQuery: string;
+ readonly onSelectFile: () => void;
+ readonly onSelected: (asset: StaticFile) => void;
+ };
+ readonly onSelectedUrl: (url: string) => void;
+};
+
export type TranscriptionModalState = {
type: 'transcribe';
src: string;
@@ -270,6 +283,7 @@ export type ModalState =
}
| ElementInstallModalState
| AddEffectModalState
+ | AssetSelectionModalState
| TranscriptionModalState
| VideoMattingModalState
| ConfirmationDialogState
diff --git a/packages/studio/src/test/quick-switcher-asset-search.test.tsx b/packages/studio/src/test/quick-switcher-asset-search.test.tsx
index 554f7f61f6..5f91772717 100644
--- a/packages/studio/src/test/quick-switcher-asset-search.test.tsx
+++ b/packages/studio/src/test/quick-switcher-asset-search.test.tsx
@@ -2,6 +2,7 @@ import {afterEach, expect, test} from 'bun:test';
import {cleanup, fireEvent, render, screen} from '@testing-library/react';
import type {AssetFieldSchema} from 'remotion';
import type {StaticFile} from '../api/get-static-files';
+import {AssetSelectorModal} from '../components/AssetSelectorModal';
import {filterAssetsByType} from '../components/QuickSwitcher/asset-search';
import {TimelineAssetField} from '../components/Timeline/TimelineAssetField';
import {SetSelectedModalContext, type ModalState} from '../state/modals';
@@ -154,8 +155,8 @@ test('an audio asset field includes only audio files', () => {
fireEvent.click(screen.getByRole('button', {name: 'Change source'}));
const modal = selectedModal as ModalState | null;
- if (modal?.type !== 'quick-switcher' || modal.assetSelection === null) {
- throw new Error('Expected asset Quick Switcher to open');
+ if (modal?.type !== 'asset-selection' || modal.assetType !== 'audio') {
+ throw new Error('Expected audio asset selector to open');
}
const result = filterAssetsByType({
@@ -170,6 +171,94 @@ test('an audio asset field includes only audio files', () => {
]);
});
+test('an image asset field replaces a protocol-relative URL', () => {
+ const fieldSchema = {
+ type: 'asset',
+ assetType: 'image',
+ default: undefined,
+ } satisfies AssetFieldSchema;
+ const url = '//cdn.example.com/images/avatar.png';
+ let selectedModal: ModalState | null = null;
+ let savedValue: unknown;
+ let dragValue: unknown;
+
+ render(
+ <SetSelectedModalContext.Provider
+ value={{
+ setSelectedModal: (update) => {
+ selectedModal =
+ typeof update === 'function' ? update(selectedModal) : update;
+ },
+ }}
+ >
+ <TimelineAssetField
+ field={{
+ key: 'imageSrc',
+ description: 'Image source',
+ typeName: 'asset',
+ rowHeight: 56,
+ fieldSchema,
+ group: 'source',
+ }}
+ propStatus={{
+ status: 'static',
+ codeValue: url,
+ keyframeDisplayOffsetAdjustment: null,
+ }}
+ effectiveValue={url}
+ onSave={(value) => {
+ savedValue = value;
+ return Promise.resolve();
+ }}
+ onDragValueChange={(value) => {
+ dragValue = value;
+ }}
+ onDragEnd={() => undefined}
+ />
+ </SetSelectedModalContext.Provider>,
+ );
+
+ const sourceButtons = screen.getAllByRole('button', {
+ name: 'Replace avatar.png',
+ });
+ expect(sourceButtons).toHaveLength(2);
+ expect(document.querySelector('img')?.getAttribute('src')).toBe(
+ 'https://cdn.example.com/images/avatar.png',
+ );
+ fireEvent.click(sourceButtons[1]);
+
+ const modal = selectedModal as ModalState | null;
+ if (modal?.type !== 'asset-selection' || modal.assetType !== 'image') {
+ throw new Error('Expected image asset selector to open');
+ }
+
+ cleanup();
+ render(
+ <SetSelectedModalContext.Provider
+ value={{
+ setSelectedModal: (update) => {
+ selectedModal =
+ typeof update === 'function' ? update(selectedModal) : update;
+ },
+ }}
+ >
+ <AssetSelectorModal readOnlyStudio={false} state={modal} />
+ </SetSelectedModalContext.Provider>,
+ );
+
+ expect(
+ screen.getByRole('button', {name: 'URL'}).getAttribute('aria-pressed'),
+ ).toBe('true');
+ const input = screen.getByLabelText('Image URL') as HTMLInputElement;
+ expect(input.value).toBe(url);
+ const replacement = '//cdn.example.com/images/new-avatar.png';
+ fireEvent.change(input, {target: {value: replacement}});
+ fireEvent.click(screen.getByRole('button', {name: 'Replace image'}));
+ expect(dragValue).toBe(replacement);
+ expect(savedValue).toBe(replacement);
+ expect(selectedModal).toBeNull();
+});
+
test('an image asset filter includes SVG files', () => {
const result = filterAssetsByType({
assets,