Closed jasonkhanlar closed 2 years ago
I am using this for now:
document.querySelectorAll('table.photoswipe img').forEach((e,i) => {
if (e.parentElement.tagName !== 'A') {
document.querySelectorAll('img')[i].outerHTML = `<a href="${e.src}" data-my-size="${e.naturalWidth}x${e.naturalHeight}">${e.outerHTML}</a>`;
}
});
Just fyi, you can via domItemData
filter https://photoswipe.com/data-sources/#custom-html-markup , but test accessibility part.
_domElementToItemData
In this function it appears to suggest that only
A
HTML elements are able to be children in a gallery to contain image data, andIMG
HTML elements are not evaluated or considered. Is there a way to include IMG elements that are not inside of an A element to be included in the gallery?For example see https://dev.moasspedia.org/photoswipe.php
or
I am preparing to work with a MediaWiki environment using wiki syntax for external hotlinked images, where the URL of an image is typed in plaintext all by itself, and that alone generates an IMG element to appear in its place, and no A element surrounding it.