diff --git a/src/BloomBrowserUI/placeHolderImages.less b/src/BloomBrowserUI/placeHolderImages.less index 7467c04502dc..8725a689762a 100644 --- a/src/BloomBrowserUI/placeHolderImages.less +++ b/src/BloomBrowserUI/placeHolderImages.less @@ -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"] diff --git a/src/BloomExe/Book/Book.cs b/src/BloomExe/Book/Book.cs index 34b9fc484681..fc66a0f60c97 100644 --- a/src/BloomExe/Book/Book.cs +++ b/src/BloomExe/Book/Book.cs @@ -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) { @@ -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; } @@ -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. } } diff --git a/src/BloomExe/BookThumbNailer.cs b/src/BloomExe/BookThumbNailer.cs index 9df6aa20645a..c5c4c8a14e27 100644 --- a/src/BloomExe/BookThumbNailer.cs +++ b/src/BloomExe/BookThumbNailer.cs @@ -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. diff --git a/src/BloomExe/Publish/PublishModel.cs b/src/BloomExe/Publish/PublishModel.cs index 9aa4826c29ff..7b5e307b80f2 100644 --- a/src/BloomExe/Publish/PublishModel.cs +++ b/src/BloomExe/Publish/PublishModel.cs @@ -831,63 +831,6 @@ public void UpdateModelUponActivation() _currentlyLoadedBook.EnsureUpToDate(); } - public IEnumerable 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; - } - } - } - /// /// 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. diff --git a/src/content/bookLayout/basePage.less b/src/content/bookLayout/basePage.less index 30ee928b0a2d..05615e468e4c 100644 --- a/src/content/bookLayout/basePage.less +++ b/src/content/bookLayout/basePage.less @@ -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