1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-02-01 19:15:01 +02:00

Clipper: Do not export invisible elements

This commit is contained in:
Laurent Cozic 2020-06-17 00:03:31 +01:00
parent 7cd0e25538
commit 53355aaad3

View File

@ -226,8 +226,9 @@
const nodeName = node.nodeName.toLowerCase();
const nodeParent = node.parentNode;
const nodeParentName = nodeParent ? nodeParent.nodeName.toLowerCase() : '';
const computedStyle = node.nodeType === 1 ? window.getComputedStyle(node) : {};
let isVisible = node.nodeType === 1 ? window.getComputedStyle(node).display !== 'none' : true;
let isVisible = node.nodeType === 1 ? computedStyle.display !== 'none' && computedStyle.visibility !== 'hidden' : true;
if (isVisible && ['script', 'noscript', 'style', 'select', 'option', 'button'].indexOf(nodeName) >= 0) isVisible = false;
// If it's a text input or a textarea and it has a value, save