From 481b328e86e974f4bf3c5a67ad4180ebca675c0b Mon Sep 17 00:00:00 2001 From: Luca Orio Date: Thu, 2 Jun 2022 16:58:48 -0700 Subject: [PATCH 1/2] fixed list of valid extensions --- src/img-gallery-renderer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/img-gallery-renderer.ts b/src/img-gallery-renderer.ts index 43ac354..6a5122a 100644 --- a/src/img-gallery-renderer.ts +++ b/src/img-gallery-renderer.ts @@ -79,7 +79,7 @@ export class imgGalleryRenderer extends MarkdownRenderChild { } // filter the list of files to make sure we're dealing with images only - const validExtensions = ["jpeg", "jpg", "gif", "png", "webp", ".tiff", ".tif"] + const validExtensions = ["jpeg", "jpg", "gif", "png", "webp", "tiff", "tif"] const images = files.filter(file => { if (file instanceof TFile && validExtensions.includes(file.extension)) return file }) From c2fd8bc8598009e7962976c6135c87dbacd033e0 Mon Sep 17 00:00:00 2001 From: Luca Orio Date: Thu, 2 Jun 2022 16:59:17 -0700 Subject: [PATCH 2/2] improved rendering of errors --- src/img-gallery-renderer.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/img-gallery-renderer.ts b/src/img-gallery-renderer.ts index 6a5122a..c608e01 100644 --- a/src/img-gallery-renderer.ts +++ b/src/img-gallery-renderer.ts @@ -150,16 +150,14 @@ export class imgGalleryRenderer extends MarkdownRenderChild { } private _renderError(error: string) { - // inject the error wrapper + // render a custom error and style it const wrapper = this.container.createEl('div') + const content = wrapper.createEl('p', {text: `(Error) Image Gallery: ${error}`}); + wrapper.style.borderRadius = '4px' wrapper.style.padding = '2px 16px' wrapper.style.backgroundColor = '#e50914' wrapper.style.color = '#fff' - - const content = wrapper.createEl('p') - content.style.fontWeight = 'bolder' - const prefix = '(Error) Image Gallery: ' - content.innerHTML = `${prefix}${error}` + wrapper.style.fontWeight = 'bolder' } }