public HtmlDom GetXmlDocumentForEditScreenWebPage()
{
var path = FileLocator.GetFileDistributedWithApplication(Path.Combine(BloomFileLocator.BrowserRoot, "bookEdit", "EditViewFrame.html"));
// {simulatedPageFileInBookFolder} is placed in the template file where we want the source file for the 'page' iframe.
// We don't really make a file for the page, the contents are just saved in our local server.
// But we give it a url that makes it seem to be in the book folder so local urls work.
// See EnhancedImageServer.MakeSimulatedPageFileInBookFolder() for more details.
var frameText = RobustFile.ReadAllText(path, Encoding.UTF8).Replace("{simulatedPageFileInBookFolder}", _currentPage.Key);
var dom = new HtmlDom(XmlHtmlConverter.GetXmlDomFromHtml(frameText));
if (_currentlyDisplayedBook.BookInfo.ToolboxIsOpen)
{
// Make the toolbox initially visible.
// What we have to do to accomplish this is pretty non-intutive. It's a consequence of the way
// the pure-drawer CSS achieves the open/close effect. This input is a check-box, so clicking it
// changes the state of things in a way that all the other CSS can depend on.
var toolboxCheckBox = dom.SelectSingleNode("//input[@id='pure-toggle-right']");
if (toolboxCheckBox != null)
toolboxCheckBox.SetAttribute("checked", "true");
}
return dom;
}