mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2024-11-23 10:21:46 +01:00
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
1 changed files with 2 additions and 0 deletions
|
@ -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 a new issue