Skip to content

Commit 6ab502f

Browse files
committed
add comment
1 parent 5f06017 commit 6ab502f

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

packages/visual-editor/src/components/migrations/0073_main_content_wrapper.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
import { Migration } from "../../utils/migrate.ts";
22

3+
// Keep only leading header content and trailing footer content at the root.
4+
//
5+
// This migration looks for:
6+
// - a leading prefix made of CustomCodeSection followed by Header or
7+
// ExpandedHeader components
8+
// - a trailing suffix made of Footer or ExpandedFooter components followed by
9+
// CustomCodeSection
10+
//
11+
// Those edge components stay at the root. Everything between them is wrapped
12+
// into MainContent, and the wrapper is inserted just before the trailing
13+
// footer suffix. Header/Footer components that appear in the middle of the
14+
// page are therefore wrapped into MainContent instead of being pulled to the
15+
// edges, which preserves the existing top-level order.
316
export const mainContentWrapperMigration: Migration = {
417
content: {
518
transformation: (content) => {
@@ -9,7 +22,6 @@ export const mainContentWrapperMigration: Migration = {
922
componentType === "ExpandedFooter" || componentType === "Footer";
1023
const isCustomCode = (componentType: string) =>
1124
componentType === "CustomCodeSection";
12-
1325
let leadingRootIndex = 0;
1426
while (
1527
leadingRootIndex < content.length &&

0 commit comments

Comments
 (0)