Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/BloomBrowserUI/placeHolderImages.less
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@
background-size: contain;
}

// When previewing in the Collection Tab, and also when in Change Layout mode in the Edit tab,
// When previewing in the Collection Tab, and also when in Change Layout mode in the Edit tab, or when dealing with
// freshly added pages that have not yet been touched by the Canvas Element Manager,
// img elements may not always be wrapped in canvas-element divs (see BL-15514 and BL-15763). Also below.
.preview,
.bloom-templateThumbnail,
.origami-layout-mode {
.bloom-canvas:not(:has(.bloom-imageContainer)):has(
img[src*="placeHolder.png"]
Expand Down
26 changes: 5 additions & 21 deletions src/BloomExe/Book/Book.cs
Original file line number Diff line number Diff line change
Expand Up @@ -645,26 +645,7 @@ public HtmlDom GetHtmlDomForPageList(HtmlDom inputDom)
return result;
}

public HtmlDom GetPreviewXmlDocumentForPage(IPage page)
{
if (HasFatalError)
{
return GetErrorDom();
}
var pageDom = GetHtmlDomWithJustOnePage(page);
pageDom.RemoveModeStyleSheets();
pageDom.EnsureStylesheetLinks(this.Storage.GetCssFilesToLinkForPreview());
// Note: it would be a fine enhancement here to first check for "branding-{flavor}.css",
// but we'll leave that until we need it.
AddPreviewJavascript(pageDom); //review: this is just for thumbnails... should we be having the javascript run?
return pageDom;
}

// Differs from GetPreviewXmlDocumentForPage() by not adding the three stylesheets
// adding them will full paths seems to be diastrous. I think cross-domain rules
// prevent them from being loaded, and so we lose the page size information, and the
// thumbs come out random sizes. Not sure why this isn't a problem in GetPreviewXmlDocumentForPage.
// Also, since this is used for thumbnails of template pages, we insert some arbitrary text
// Since this is used for thumbnails of template pages, we insert text placeholders (grey bars)
// into empty editable divs to give a better idea of what a typical page will look like.
internal HtmlDom GetThumbnailXmlDocumentForPage(IPage page)
{
Expand All @@ -674,6 +655,7 @@ internal HtmlDom GetThumbnailXmlDocumentForPage(IPage page)
}
var pageDom = GetHtmlDomWithJustOnePage(page);
AddPreviewJavascript(pageDom);
pageDom.EnsureStylesheetLinks(this.Storage.GetCssFilesToLinkForPreview());
pageDom.Body.AddClass("bloom-templateThumbnail");
return pageDom;
}
Expand Down Expand Up @@ -2163,7 +2145,9 @@ private void CreateOrUpdateDefaultLangStyles()
{
var lang = line.Substring(kLangTag.Length, idxQuote - kLangTag.Length);
// Don't let empty language tag creep in (or stay in). (BL-15784)
copyCurrentRule = !String.IsNullOrEmpty(lang) && !languagesWeAlreadyHave.Contains(lang);
copyCurrentRule =
!String.IsNullOrEmpty(lang)
&& !languagesWeAlreadyHave.Contains(lang);
languagesWeAlreadyHave.Add(lang); // don't copy if another css block has crept in.
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/BloomExe/BookThumbNailer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ Guid requestId
/// Currently used by the image server
/// to get thumbnails that are used in the add page dialog. Since this dialog can show
/// an enlarged version of the page, we generate these at a higher resolution than usual.
/// Also, to make more realistic views of template pages we insert fake text wherever
/// Also, to make more realistic views of template pages we insert text placeholders (grey bars) wherever
/// there is an empty edit block.
///
/// The result is cached for possible future use so the caller should not dispose of it.
Expand Down
57 changes: 0 additions & 57 deletions src/BloomExe/Publish/PublishModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -831,63 +831,6 @@ public void UpdateModelUponActivation()
_currentlyLoadedBook.EnsureUpToDate();
}

public IEnumerable<HtmlDom> GetPageDoms()
{
if (BookSelection.CurrentSelection.IsFolio)
{
foreach (var bi in _currentBookCollectionSelection.CurrentSelection.GetBookInfos())
{
var book = _bookServer.GetBookFromBookInfo(bi);
//need to hide the "notes for illustrators" on SHRP, which is controlled by the layout
book.SetLayout(
new Layout()
{
SizeAndOrientation = SizeAndOrientation.FromString("B5Portrait"),
Style = "HideProductionNotes",
}
);
foreach (var page in book.GetPages())
{
//yield return book.GetPreviewXmlDocumentForPage(page);

var previewXmlDocumentForPage = book.GetPreviewXmlDocumentForPage(page);
BookStorage.SetBaseForRelativePaths(
previewXmlDocumentForPage,
book.FolderPath
);

AddStylesheetClasses(previewXmlDocumentForPage.RawDom);

yield return previewXmlDocumentForPage;
}
}
}
else //this one is just for testing, it's not especially fruitful to export for a single book
{
//need to hide the "notes for illustrators" on SHRP, which is controlled by the layout
BookSelection.CurrentSelection.SetLayout(
new Layout()
{
SizeAndOrientation = SizeAndOrientation.FromString("B5Portrait"),
Style = "HideProductionNotes",
}
);

foreach (var page in BookSelection.CurrentSelection.GetPages())
{
var previewXmlDocumentForPage =
BookSelection.CurrentSelection.GetPreviewXmlDocumentForPage(page);
//get the original images, not compressed ones (just in case the thumbnails are, like, full-size & they want quality)
BookStorage.SetBaseForRelativePaths(
previewXmlDocumentForPage,
BookSelection.CurrentSelection.FolderPath
);
AddStylesheetClasses(previewXmlDocumentForPage.RawDom);
yield return previewXmlDocumentForPage;
}
}
}

/// <summary>
/// Remove all text data that is not in a desired language.
/// Keeps all xmatter data if shouldPruneXmatter is false; if it is true, keeps xmatter data in xmatterLangsToKeep.
Expand Down
13 changes: 13 additions & 0 deletions src/content/bookLayout/basePage.less
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,19 @@ div.bloomPlayer-page {
display: none;
}

// bloom-canvas-elements may have their height and width specified in a style attribute, and this size may not be
// right if we use a different paper size when making thumbnails for the add page dialog.
// And ReplaceAnyVideoElementsWithPlaceholder adds video placeholders without making them the right size.
// We want to override any such sizing and just blow all the placeholders up big so that the resulting thumbnail
// will show the user the layout of the page. We don't need precision here.
.bloom-imageContainer:has(img[src*="video-placeholder.svg"]),
.bloom-canvas-element.bloom-backgroundImage:has(
img[src*="placeHolder.png"]
) {
height: 100% !important;
width: 100% !important;
}

.bloom-translationGroup {
// Height in ems so it is sensitive to font size. The '1 transparent/3 grey' here is not necessarily
// ideal, and was just arrived at through experimentation, balancing accuracy
Expand Down