diff --git a/API/Services/BookService.cs b/API/Services/BookService.cs index fedd2ddb9..c73b412ae 100644 --- a/API/Services/BookService.cs +++ b/API/Services/BookService.cs @@ -246,12 +246,16 @@ namespace API.Services private static void ScopeImages(HtmlDocument doc, EpubBookRef book, string apiBase) { var images = doc.DocumentNode.SelectNodes("//img") - ?? doc.DocumentNode.SelectNodes("//image"); + ?? doc.DocumentNode.SelectNodes("//image") ?? doc.DocumentNode.SelectNodes("//svg"); if (images == null) return; + + var parent = images.First().ParentNode; + foreach (var image in images) { + string key = null; if (image.Attributes["src"] != null) { @@ -269,6 +273,7 @@ namespace API.Services image.Attributes.Add(key, $"{apiBase}" + imageFile); // Add a custom class that the reader uses to ensure images stay within reader + parent.AddClass("kavita-scale-width-container"); image.AddClass("kavita-scale-width"); } diff --git a/UI/Web/src/app/book-reader/book-reader/book-reader.component.scss b/UI/Web/src/app/book-reader/book-reader/book-reader.component.scss index 3eb8a3a7f..568ce5210 100644 --- a/UI/Web/src/app/book-reader/book-reader/book-reader.component.scss +++ b/UI/Web/src/app/book-reader/book-reader/book-reader.component.scss @@ -59,6 +59,8 @@ $action-bar-height: 38px; } .drawer-body { + overflow: auto; + .reader-pills { justify-content: center; margin: 0 0.25rem; @@ -244,6 +246,11 @@ $action-bar-height: 38px; } } +// This is applied to images in the backend +::ng-deep .kavita-scale-width-container { + width: auto; + max-height: calc((var(--vh)*100) - 116px) !important; +} // This is applied to images in the backend ::ng-deep .kavita-scale-width {