fix: check if paragraph exists before accessing it's textContent
closes https://github.com/CaiJimmy/hugo-theme-stack/issues/490
This commit is contained in:
parent
4b0dbb4630
commit
0fbbc12949
@ -67,6 +67,8 @@ class StackGallery {
|
|||||||
/// This is done to allow inline images within paragraphs
|
/// This is done to allow inline images within paragraphs
|
||||||
const paragraph = img.closest('p');
|
const paragraph = img.closest('p');
|
||||||
|
|
||||||
|
if (!paragraph || !container.contains(paragraph)) continue;
|
||||||
|
|
||||||
if (paragraph.textContent.trim() == '') {
|
if (paragraph.textContent.trim() == '') {
|
||||||
/// Once we insert figcaption, this check no longer works
|
/// Once we insert figcaption, this check no longer works
|
||||||
/// So we add a class to paragraph to mark it
|
/// So we add a class to paragraph to mark it
|
||||||
|
Loading…
Reference in New Issue
Block a user