shorten_expanded: fix for posts without attachments
This commit is contained in:
parent
5c4223992f
commit
6e06fe2885
|
@ -25,19 +25,22 @@ require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready) {
|
||||||
if (row) {
|
if (row) {
|
||||||
|
|
||||||
const content = row.querySelector(".content-inner");
|
const content = row.querySelector(".content-inner");
|
||||||
const attachments = row.querySelector(".attachments-inline");
|
|
||||||
|
|
||||||
if (content && attachments &&
|
//console.log('shorten', row.offsetHeight, 'vs', _shorten_expanded_threshold * window.innerHeight);
|
||||||
row.offsetHeight >= _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 = `
|
||||||
<div class="content-shrink-wrap">
|
<div class="content-shrink-wrap">
|
||||||
${content.innerHTML}
|
${content.innerHTML}
|
||||||
${attachments.innerHTML}
|
${attachments ? attachments.innerHTML : ''}
|
||||||
</div>
|
</div>
|
||||||
<button dojoType="dijit.form.Button" class="alt-info expand-prompt" onclick="return Plugins.Shorten_Expanded.expand('${row.id}')" href="#">
|
<button dojoType="dijit.form.Button" class="alt-info expand-prompt" onclick="return Plugins.Shorten_Expanded.expand('${row.id}')" href="#">
|
||||||
${__("Click to expand article")}</button>`;
|
${__("Click to expand article")}</button>`;
|
||||||
|
|
||||||
|
if (attachments)
|
||||||
attachments.innerHTML = "";
|
attachments.innerHTML = "";
|
||||||
|
|
||||||
dojo.parser.parse(content);
|
dojo.parser.parse(content);
|
||||||
|
|
Loading…
Reference in New Issue