Skip to content

Commit dedc4fb

Browse files
author
Travis Wagner
committed
fix type 'image' being ignored
1 parent acf3d40 commit dedc4fb

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ npm i bs5-lightbox
1616

1717
##### CDN:
1818
```html
19-
<script src="https://cdn.jsdelivr.net/npm/[email protected].8/dist/index.bundle.min.js"></script>
19+
<script src="https://cdn.jsdelivr.net/npm/[email protected].9/dist/index.bundle.min.js"></script>
2020
```
2121

2222
Or [download the file directly](https://raw.githubusercontent.com/trvswgnr/bs5-lightbox/main/dist/index.bundle.min.js) (right-click, Save As...)

dist/index.bundle.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ class Lightbox {
8383
}
8484
}
8585
isEmbed(src) {
86-
const regex = new RegExp(Lightbox.allowedEmbedTypes.join('|'));
86+
const regex = new RegExp('(' + Lightbox.allowedEmbedTypes.join('|') + ')');
8787
const isEmbed = regex.test(src);
88-
const isImg = /\.(png|jpe?g|gif|svg|webp)/.test(src);
88+
const isImg = /\.(png|jpe?g|gif|svg|webp)/.test(src) || this.el.dataset.type === 'image';
8989
return isEmbed || !isImg;
9090
}
9191
createCarousel() {

docs/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ <h2>Installation</h1>
392392

393393
Or grab the latest JS from the CDN and add it after Bootstrap's JS:
394394
</div>
395-
<pre><code class="language-html">&lt;script src="https://cdn.jsdelivr.net/npm/[email protected].8/dist/index.bundle.min.js"&gt;&lt;/script&gt;</code></pre>
395+
<pre><code class="language-html">&lt;script src="https://cdn.jsdelivr.net/npm/[email protected].9/dist/index.bundle.min.js"&gt;&lt;/script&gt;</code></pre>
396396
<div class="markdown">
397397
Or [download the file directly](https://raw.githubusercontent.com/trvswgnr/bs5-lightbox/main/dist/index.bundle.min.js) (right-click, Save As...)
398398

@@ -608,7 +608,7 @@ <h2>Contributing</h2>
608608
</div>
609609

610610
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
611-
<script src="https://cdn.jsdelivr.net/npm/[email protected].8/dist/index.bundle.min.js"></script>
611+
<script src="https://cdn.jsdelivr.net/npm/[email protected].9/dist/index.bundle.min.js"></script>
612612
<script src="https://cdnjs.cloudflare.com/ajax/libs/markdown-it/12.2.0/markdown-it.min.js" integrity="sha512-cTQeM/op796Fp1ZUxfech8gSMLT/HvrXMkRGdGZGQnbwuq/obG0UtcL04eByVa99qJik7WlnlQOr5/Fw5B36aw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
613613
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.2.0/highlight.min.js"></script>
614614
<script>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bs5-lightbox",
3-
"version": "1.7.8",
3+
"version": "1.7.9",
44
"author": {
55
"name": "Travis Aaron Wagner",
66
"email": "[email protected]"

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ class Lightbox {
121121
}
122122

123123
private isEmbed(src: string): boolean {
124-
const regex = new RegExp(Lightbox.allowedEmbedTypes.join('|'));
124+
const regex = new RegExp('(' + Lightbox.allowedEmbedTypes.join('|') + ')');
125125
const isEmbed = regex.test(src);
126-
const isImg = /\.(png|jpe?g|gif|svg|webp)/.test(src);
126+
const isImg = /\.(png|jpe?g|gif|svg|webp)/.test(src) || this.el.dataset.type === 'image';
127127
return isEmbed || !isImg;
128128
}
129129

0 commit comments

Comments
 (0)