Skip to content
Closed
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
5 changes: 3 additions & 2 deletions DistFiles/localization/en/Bloom.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1361,7 +1361,7 @@
<source xml:lang="en">Image</source>
<note>ID: EditTab.CustomPage.Image</note>
</trans-unit>
<trans-unit id="EditTab.CustomPage.Canvas" sil:dynamic="true">
<trans-unit id="EditTab.CustomPage.Canvas" sil:dynamic="true" translate="no">
<source xml:lang="en">Canvas</source>
<note>ID: EditTab.CustomPage.Canvas</note>
</trans-unit>
Expand Down Expand Up @@ -1877,9 +1877,10 @@
<note>ID: EditTab.ImageMetadata.Corrupt.MoreInfo</note>
<note>label of a button to click to display a website with more information</note>
</trans-unit>
<trans-unit id="EditTab.Image.CutImage" sil:dynamic="true">
<trans-unit id="EditTab.Image.CutImage" sil:dynamic="true" translate="no">
<source xml:lang="en">Cut image</source>
<note>ID: EditTab.Image.CutImage</note>
<note>Obsolete as of 6.3</note>
</trans-unit>
<trans-unit id="EditTab.Image.EditMetadata" sil:dynamic="true">
<source xml:lang="en">Edit image credits, copyright, &amp; license</source>
Expand Down
1 change: 0 additions & 1 deletion artwork/canvas-placeholder.svg

This file was deleted.

1 change: 0 additions & 1 deletion artwork/placeholder.svg

This file was deleted.

5 changes: 2 additions & 3 deletions src/BloomBrowserUI/bookEdit/css/editMode.less
Original file line number Diff line number Diff line change
Expand Up @@ -1376,10 +1376,9 @@ canvas.moving {
pointer-events: none;
background-color: transparent;

// background images can't be manually resized
// background images can't be manually resized, but they can be cropped
&.bloom-backgroundImage-control-frame {
.bloom-ui-canvas-element-resize-handle,
.bloom-ui-canvas-element-side-handle {
.bloom-ui-canvas-element-resize-handle {
display: none;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/BloomBrowserUI/bookEdit/js/CanvasElementManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2693,7 +2693,7 @@ export class CanvasElementManager {
!useSizeOfNewImage && // not waiting for new dimensions
imgOrVideo.classList.contains("bloom-imageLoadError")) // error occurred while trying to load
) {
// Image is in an error state; we probably won't ever get useful dimensions. Just leave
// Image is a placeholder or in an error state; we probably won't ever get useful dimensions. Just leave
// the canvas element the shape it is.
return;
}
Expand Down
11 changes: 8 additions & 3 deletions src/BloomBrowserUI/bookEdit/js/bloomImages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,17 @@ export const kImageContainerSelector = `.${kImageContainerClass}`;
// We don't use actual placeHolder.png files anymore, but we do continue to use
// src="placeHolder.png" to mark placeholders
export function isPlaceHolderImage(
filename: string | null | undefined,
url: string | null | undefined,
): boolean {
if (!filename) {
if (!url) {
return false;
}
return filename.toLowerCase().endsWith("placeholder.png");
// Extract just the filename part to handle cases like "placeHolder.png?cachebust=12345"
// or paths like "book/placeHolder.png"
const urlLower = url.toLowerCase();
const questionMarkIndex = urlLower.indexOf("?");
const pathPart = questionMarkIndex >= 0 ? urlLower.substring(0, questionMarkIndex) : urlLower;
return pathPart.endsWith("placeholder.png");
}

export function cleanupImages() {
Expand Down
8 changes: 4 additions & 4 deletions src/BloomExe/Book/Book.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5190,10 +5190,10 @@ ref coverImageFileName
);
// We no longer put placeHolder.png files in books (BL-15441) but we still need to detect when the placeholder
// is called for, so here we return placeHolder.png instead of null. Callers of this method should handle this special case.
if (
!ImageUtils.IsPlaceholderImageFilename(coverImagePath)
&& !RobustFile.Exists(coverImagePath)
)
if (ImageUtils.IsPlaceholderImageFilename(coverImagePath))
return coverImagePath;

if (!RobustFile.Exists(coverImagePath))
{
// And the filename might be multiply-HTML encoded.
while (coverImagePath.Contains("&amp;"))
Expand Down
1 change: 1 addition & 0 deletions src/BloomExe/BookThumbNailer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ internal static bool CreateThumbnailOfCoverImage(
BloomFileLocator.BrowserRoot
);
imageSrc = Path.Combine(bloomRoot, "images", "placeHolder.png");
// Enhance: We are unnecessarily running some image checks/processing below even in the placeholder case.
}
if (!IsCoverImageSrcValid(imageSrc, options))
{
Expand Down
5 changes: 3 additions & 2 deletions src/BloomExe/Publish/BloomPub/BloomPubMaker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -727,8 +727,9 @@ private static void StripImgIfWeCannotFindFile(SafeXmlDocument dom, string bookF
var imgElt in dom.SafeSelectNodes("//img[@src]").Cast<SafeXmlElement>().ToArray()
)
{
// As of BL-15441, we don't use real files for place holders but we still mark them with src="placeHolder.png".
// Don't strip these - we want them to persist in template books, and for other books we are already removing them elsewhere.
// As of BL-15441, we don't use real files for place holders (except in templates) but we still mark them with src="placeHolder.png".
// Don't strip them here -- we want them to persist in template books. For other books we are already removing them
// elsewhere (see line 540 where we delete placeHolder.png from the book folder).
string src = imgElt.GetAttribute("src");
if (ImageUtils.IsPlaceholderImageFilename(src))
continue;
Expand Down
3 changes: 3 additions & 0 deletions src/BloomExe/web/BloomServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,9 @@ private bool ProcessImageFileRequest(IRequestInfo info)
}
else if (ImageUtils.IsPlaceholderImageFilename(imageFile))
{
// BL-15441: We no longer use real files for placeholders, but the HTML still references placeHolder.png.
// The placeholder is displayed via CSS. Return a 404 so the browser knows there's no file.
info.WriteError(404);
return true;
}
// If the user does add a video or widget, these placeholder .svgs will get copied to the
Expand Down