diff --git a/plugins/shorten_expanded/init.js b/plugins/shorten_expanded/init.js index 181e426a4..873749c03 100644 --- a/plugins/shorten_expanded/init.js +++ b/plugins/shorten_expanded/init.js @@ -25,20 +25,23 @@ require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready) { if (row) { const content = row.querySelector(".content-inner"); - const attachments = row.querySelector(".attachments-inline"); - if (content && attachments && - row.offsetHeight >= _shorten_expanded_threshold * window.innerHeight) { + //console.log('shorten', row.offsetHeight, 'vs', _shorten_expanded_threshold * window.innerHeight); + + if (content && row.offsetHeight >= _shorten_expanded_threshold * window.innerHeight) { + + const attachments = row.querySelector(".attachments-inline"); // optional content.innerHTML = `
${content.innerHTML} - ${attachments.innerHTML} + ${attachments ? attachments.innerHTML : ''}
`; - attachments.innerHTML = ""; + if (attachments) + attachments.innerHTML = ""; dojo.parser.parse(content); }