From 8abf1c844c656b41a604098889db76e8c63da720 Mon Sep 17 00:00:00 2001 From: Kara Erickson Date: Thu, 18 Aug 2022 14:28:58 -0700 Subject: [PATCH] fix(common): fix formatting on oversized image error (#47188) This is a tiny commit to add newlines in the image directive's "oversized image" error. Currently, the rendered and intrinsic image sizes are printed mid-line, which make them a little hard to read. This commit puts them each on their own line. PR Close #47188 --- .../directives/ng_optimized_image/ng_optimized_image.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/common/src/directives/ng_optimized_image/ng_optimized_image.ts b/packages/common/src/directives/ng_optimized_image/ng_optimized_image.ts index 50be8c152b574..1d6c8a80185ef 100644 --- a/packages/common/src/directives/ng_optimized_image/ng_optimized_image.ts +++ b/packages/common/src/directives/ng_optimized_image/ng_optimized_image.ts @@ -628,10 +628,11 @@ function assertNoImageDistortion( RuntimeErrorCode.OVERSIZED_IMAGE, `${imgDirectiveDetails(dir.rawSrc)} the intrinsic image is significantly ` + `larger than necessary. ` + - `Rendered image size: ${renderedWidth}w x ${renderedHeight}h. ` + - `Intrinsic image size: ${intrinsicWidth}w x ${intrinsicHeight}h. ` + - `Recommended intrinsic image size: ${recommendedWidth}w x ${recommendedHeight}h. ` + - `Note: Recommended intrinsic image size is calculated assuming a maximum DPR of ` + + `\nRendered image size: ${renderedWidth}w x ${renderedHeight}h. ` + + `\nIntrinsic image size: ${intrinsicWidth}w x ${intrinsicHeight}h. ` + + `\nRecommended intrinsic image size: ${recommendedWidth}w x ${ + recommendedHeight}h. ` + + `\nNote: Recommended intrinsic image size is calculated assuming a maximum DPR of ` + `${RECOMMENDED_SRCSET_DENSITY_CAP}. To improve loading time, resize the image ` + `or consider using the "rawSrcset" and "sizes" attributes.`)); }