Skip to content

Commit

Permalink
fix type 'image' being ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis Wagner committed Mar 23, 2022
1 parent acf3d40 commit dedc4fb
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ npm i bs5-lightbox

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

Or [download the file directly](https://raw.githubusercontent.com/trvswgnr/bs5-lightbox/main/dist/index.bundle.min.js) (right-click, Save As...)
Expand Down
4 changes: 2 additions & 2 deletions dist/index.bundle.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ class Lightbox {
}
}
isEmbed(src) {
const regex = new RegExp(Lightbox.allowedEmbedTypes.join('|'));
const regex = new RegExp('(' + Lightbox.allowedEmbedTypes.join('|') + ')');
const isEmbed = regex.test(src);
const isImg = /\.(png|jpe?g|gif|svg|webp)/.test(src);
const isImg = /\.(png|jpe?g|gif|svg|webp)/.test(src) || this.el.dataset.type === 'image';
return isEmbed || !isImg;
}
createCarousel() {
Expand Down
4 changes: 2 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ <h2>Installation</h1>

Or grab the latest JS from the CDN and add it after Bootstrap's JS:
</div>
<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>
<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>
<div class="markdown">
Or [download the file directly](https://raw.githubusercontent.com/trvswgnr/bs5-lightbox/main/dist/index.bundle.min.js) (right-click, Save As...)

Expand Down Expand Up @@ -608,7 +608,7 @@ <h2>Contributing</h2>
</div>

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected].8/dist/index.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected].9/dist/index.bundle.min.js"></script>
<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>
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.2.0/highlight.min.js"></script>
<script>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bs5-lightbox",
"version": "1.7.8",
"version": "1.7.9",
"author": {
"name": "Travis Aaron Wagner",
"email": "[email protected]"
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ class Lightbox {
}

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

Expand Down

0 comments on commit dedc4fb

Please sign in to comment.