-
-
Notifications
You must be signed in to change notification settings - Fork 18
Keep custom-layout page audio data (BL-16109) #7829
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1732,21 +1732,30 @@ public void GatherDataItemsFromXElement( | |
| private List<Tuple<string, XmlString>> GetAttributesToSave(SafeXmlElement node) | ||
| { | ||
| var result = new List<Tuple<string, XmlString>>(); | ||
| if (HtmlDom.IsInCustomLayoutPage(node)) | ||
| if (node.Name == "img" && HtmlDom.IsInCustomLayoutPage(node)) | ||
| { | ||
| // We don't want to transfer attribute values or classes from the custom page | ||
| // We don't want to transfer most image attribute values or classes from the custom page | ||
| // layout to the standard one. It's likely that special styling or image cropping | ||
| // or anything similar will have the wrong effect there. The one exception is the | ||
| // src of an image: we allow changing the cover image in one place to change it in | ||
| // the other, just as changing the text of a title in one place changes it in both. | ||
| // We don't need to worry about re-creating attribute values inside the custom margin | ||
| // box, because its whole content is saved. | ||
| if (node.Name == "img" && !string.IsNullOrWhiteSpace(node.GetAttribute("src"))) | ||
| // We do want to transfer data normally for text elements; for example, talking book | ||
| // recordings should transfer (and also survive the book being opened in 6.3). | ||
| if (!string.IsNullOrWhiteSpace(node.GetAttribute("src"))) | ||
| result.Add( | ||
| Tuple.Create("src", XmlString.FromUnencoded(node.GetAttribute("src"))) | ||
| ); | ||
| return result; | ||
| } | ||
| // Margin box doesn't have any of the properties that would normally make it one of the nodes | ||
| // passed to this method. However, it is the node that gets passed for a custom page. It would | ||
| // probably be harmless to process it normally, but it would result in the data-div node for | ||
| // the custom page content having the class marignBox. That might cause something unexpected, | ||
| // and the marginBox doesn't have any classes or attributes we need to preserve, so just skip it. | ||
| if (node.HasClass("marginBox")) | ||
| return result; | ||
|
Comment on lines
+1735
to
+1758
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚩 Behavioral change: all attributes on text elements in custom layout pages now transfer to standard pages The old code at Was this helpful? React with 👍 or 👎 to provide feedback. |
||
| foreach (var attr in node.AttributePairs) | ||
| { | ||
| if (_attributesNotToCopy.Contains(attr.Name)) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.