Derivative preserves custom pages (BL-16074)#7809
Conversation
Also better handles various aspects of restoring a saved custom page state (e.g., disabled because no subscription) when the languages have changed since the custom page was saved.
|
|
||
| InjectXMatter(initialPath, storage, sizeAndOrientation); | ||
|
|
||
| // Restore bloom-customLayout to any pages that had it before xmatter replacement. | ||
| XMatterHelper.RestoreCustomLayoutClasses(storage.Dom, customLayoutIds); |
There was a problem hiding this comment.
🚩 GatherCustomLayoutIds/RestoreCustomLayoutClasses may be a no-op in BookStarter for xmatter pages
The newly added GatherCustomLayoutIds at BookStarter.cs:256 collects IDs from pages with bloom-customLayout before xmatter removal. After InjectXMatter at line 286, the new xmatter pages come from generic templates that lack data-custom-layout-id attributes. Therefore RestoreCustomLayoutClasses at line 289 searches for @data-custom-layout-id on pages (XPath at XMatterHelper.cs:562) but won't find any on the freshly injected template pages. This makes the Gather/Restore pair effectively a no-op for xmatter pages in the BookStarter path. The bloom-customLayout class and custom content would only be properly restored later when the book is fully loaded via EnsureUpToDate → SynchronizeDataItemsThroughoutDOM. This is harmless (no incorrect behavior), but worth noting that the protection is not actually active in this code path. The same pattern in Book.cs:BringXmatterHtmlUpToDate works because SynchronizeDataItemsThroughoutDOM runs shortly after and restores data-custom-layout-id to the pages before they're used.
(Refers to lines 254-289)
Was this helpful? React with 👍 or 👎 to provide feedback.
Also better handles various aspects of restoring a saved custom page state (e.g., disabled because no subscription) when the languages have changed since the custom page was saved.
This change is