Bloom.Book.Book.SavePage C# (CSharp) Method

SavePage() public method

Earlier, we handed out a single-page version of the document. Now it has been edited, so we now we need to fold changes back in
public SavePage ( HtmlDom editedPageDom ) : void
editedPageDom HtmlDom
return void
        public void SavePage(HtmlDom editedPageDom)
        {
            Debug.Assert(IsEditable);
            try
            {
                // This is needed if the user did some ChangeLayout (origami) manipulation. This will populate new
                // translationGroups with .bloom-editables and set the proper classes on those editables to match the current multilingual settings.
                UpdateEditableAreasOfElement(editedPageDom);

                //replace the corresponding page contents in our DOM with what is in this PageDom
                XmlElement pageFromEditedDom = editedPageDom.SelectSingleNodeHonoringDefaultNS("//div[contains(@class, 'bloom-page')]");
                string pageId = pageFromEditedDom.GetAttribute("id");
                var pageFromStorage = GetPageFromStorage(pageId);

                HtmlDom.ProcessPageAfterEditing(pageFromStorage, pageFromEditedDom);

                _bookData.SuckInDataFromEditedDom(editedPageDom); //this will do an updatetitle
                // When the user edits the styles on a page, the new or modified rules show up in a <style/> element with title "userModifiedStyles". Here we copy that over to the book DOM.
                var userModifiedStyles = editedPageDom.SelectSingleNode("html/head/style[@title='userModifiedStyles']");
                if (userModifiedStyles != null)
                {
                    GetOrCreateUserModifiedStyleElementFromStorage().InnerXml = userModifiedStyles.InnerXml;
                    //Debug.WriteLine("Incoming User Modified Styles:   " + userModifiedStyles.OuterXml);
                }
                Save();

                _storage.UpdateBookFileAndFolderName(_collectionSettings);
                //review used to have   UpdateBookFolderAndFileNames(data);

                //Enhance: if this is only used to re-show the thumbnail, why not limit it to if this is the cover page?
                //e.g., look for the class "cover"
                InvokeContentsChanged(null); //enhance: above we could detect if anything actually changed
            }
            catch (Exception error)
            {
                var msg = LocalizationManager.GetString("Errors.CouldNotSavePage",
                    "Bloom had trouble saving a page. Please click Details below and report this to us. Then quit Bloom, run it again, and check to see if the page you just edited is missing anything. Sorry!");
                ErrorReport.NotifyUserOfProblem(error, msg);
            }
        }
Book