File tree Expand file tree Collapse file tree
packages/visual-editor/src/components/migrations Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { 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.
316export 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 &&
You can’t perform that action at this time.
0 commit comments