diff --git a/packages/studio/src/components/editor/manualEdits.test.ts b/packages/studio/src/components/editor/manualEdits.test.ts
index 89f26b0f18..4be1db5dd8 100644
--- a/packages/studio/src/components/editor/manualEdits.test.ts
+++ b/packages/studio/src/components/editor/manualEdits.test.ts
@@ -657,6 +657,48 @@ describe("studio manual edits", () => {
expect(readStudioPathOffset(nestedCard)).toEqual({ x: 24, y: 12 });
});
+ it("applies nested source edits while previewing a non-index parent composition", () => {
+ const document = createDocument(`
+
+ `);
+ const parentCard = document.getElementById("parent-card") as HTMLElement;
+ const childCard = document.getElementById("child-card") as HTMLElement;
+ const manifest = parseStudioManualEditManifest(`{
+ "version": 1,
+ "edits": [
+ {
+ "kind": "path-offset",
+ "target": {
+ "sourceFile": "scenes/parent.html",
+ "selector": "#parent-card",
+ "id": "parent-card"
+ },
+ "x": 12,
+ "y": 8
+ },
+ {
+ "kind": "path-offset",
+ "target": {
+ "sourceFile": "scenes/child.html",
+ "selector": "#child-card",
+ "id": "child-card"
+ },
+ "x": 36,
+ "y": 18
+ }
+ ]
+ }`);
+
+ expect(applyStudioManualEditManifest(document, manifest, "scenes/parent.html")).toBe(2);
+ expect(readStudioPathOffset(parentCard)).toEqual({ x: 12, y: 8 });
+ expect(readStudioPathOffset(childCard)).toEqual({ x: 36, y: 18 });
+ });
+
it("applies and clears manifest box sizes while restoring authored inline size", () => {
const document = createDocument(`
diff --git a/packages/studio/src/components/editor/manualEdits.ts b/packages/studio/src/components/editor/manualEdits.ts
index 057c60dd7b..db412223fb 100644
--- a/packages/studio/src/components/editor/manualEdits.ts
+++ b/packages/studio/src/components/editor/manualEdits.ts
@@ -1232,11 +1232,6 @@ export function installStudioManualEditSeekReapply(win: Window, apply: () => voi
);
}
-function sourceFileMatches(activeCompositionPath: string | null, sourceFile: string): boolean {
- if (!activeCompositionPath || activeCompositionPath === "index.html") return true;
- return activeCompositionPath === sourceFile;
-}
-
function getManualEditSourceFileForElement(
el: HTMLElement,
activeCompositionPath: string | null,
@@ -1286,7 +1281,6 @@ function resolveManualEditTarget(
edit: StudioManualEdit,
activeCompositionPath: string | null,
): HTMLElement | null {
- if (!sourceFileMatches(activeCompositionPath, edit.target.sourceFile)) return null;
const htmlElement = doc.defaultView?.HTMLElement;
if (!htmlElement) return null;