|
2 | 2 | By André Rinas, www.andrerinas.de |
3 | 3 | Documentation, www.simplelightbox.com |
4 | 4 | Available for use under the MIT License |
5 | | - Version 2.14.1 |
| 5 | + Version 2.14.2 |
6 | 6 | */ |
7 | 7 | (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ |
8 | 8 | (function (global){(function (){ |
@@ -42,6 +42,7 @@ var SimpleLightbox = /*#__PURE__*/function () { |
42 | 42 | captionsData: 'title', |
43 | 43 | captionPosition: 'bottom', |
44 | 44 | captionClass: '', |
| 45 | + captionHTML: true, |
45 | 46 | close: true, |
46 | 47 | closeText: '×', |
47 | 48 | swipeClose: true, |
@@ -259,7 +260,7 @@ var SimpleLightbox = /*#__PURE__*/function () { |
259 | 260 | if (this.options.captionSelector.startsWith('+')) { |
260 | 261 | var selector = this.options.captionSelector.replace(/^\+/, '').trimStart(); |
261 | 262 | var sibling = elem.nextElementSibling; |
262 | | - if (sibling.matches(selector)) { |
| 263 | + if (sibling && sibling.matches(selector)) { |
263 | 264 | return sibling; |
264 | 265 | } |
265 | 266 | return false; |
@@ -1095,12 +1096,14 @@ var SimpleLightbox = /*#__PURE__*/function () { |
1095 | 1096 | } |
1096 | 1097 | }, { |
1097 | 1098 | key: "setCaption", |
1098 | | - value: function setCaption(captionText, imageWidth) { |
| 1099 | + value: function setCaption(captionText, imageWidth, allowHTML) { |
1099 | 1100 | var _this7 = this; |
1100 | 1101 | if (this.options.captions && captionText && captionText !== '' && typeof captionText !== "undefined") { |
| 1102 | + var _ref; |
| 1103 | + var property = ((_ref = allowHTML !== null && allowHTML !== void 0 ? allowHTML : this.options.captionHTML) !== null && _ref !== void 0 ? _ref : true) ? 'innerHTML' : 'innerText'; |
1101 | 1104 | this.hide(this.domNodes.caption); |
1102 | 1105 | this.domNodes.caption.style.width = imageWidth + 'px'; |
1103 | | - this.domNodes.caption.innerHTML = captionText; |
| 1106 | + this.domNodes.caption[property] = captionText; |
1104 | 1107 | this.domNodes.image.appendChild(this.domNodes.caption); |
1105 | 1108 | setTimeout(function () { |
1106 | 1109 | _this7.fadeIn(_this7.domNodes.caption, _this7.options.fadeSpeed); |
|
0 commit comments