Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Brief Description Popover extraction Issue #1278

Merged
merged 11 commits into from
Oct 12, 2024
6 changes: 2 additions & 4 deletions www/js/lib/popovers.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,12 @@ function cleanUpLedeContent (node) {
styleElements.forEach(style => {
style.parentNode.removeChild(style);
});
const paragraphs = Array.from(node.querySelectorAll('p'));
// Filter out empty paragraphs or those with less than 50 characters
Jaifroid marked this conversation as resolved.
Show resolved Hide resolved
const paragraphs = Array.from(node.querySelectorAll('p:not(#pcs-edit-section-title-description)'));
THEBOSS0369 marked this conversation as resolved.
Show resolved Hide resolved
const parasWithContent = paragraphs.filter(para => {
// DEV: Note that innerText is not supported in Firefox OS, so we need to use textContent as a fallback
// The reason we prefer innerText is that it strips out hidden text and unnecessary whitespace, which is not the case with textContent
const innerText = para.innerText ? para.innerText : para.textContent;
const text = innerText.trim();
return !/^\s*$/.test(text) && text.length >= 50;
THEBOSS0369 marked this conversation as resolved.
Show resolved Hide resolved
return innerText.length >= 50;
});
return parasWithContent;
}
Expand Down
Loading