diff options
| author | bobzel <zzzman@gmail.com> | 2020-10-11 01:33:28 -0400 |
|---|---|---|
| committer | bobzel <zzzman@gmail.com> | 2020-10-11 01:33:28 -0400 |
| commit | 65448167a4db396b2ee3c56d870233f8ac182eb6 (patch) | |
| tree | 28b1561d4fdf170543538cbc145d7381e93b9191 /src/client/views/collections/collectionFreeForm | |
| parent | 858fdbf31c9ddbf00eae692cd43e70455a19e1b5 (diff) | |
prevented documents that are unshared (ie private to soeone else) from showing up as an empty key value in stacking and other views. tried to fix an exception when showing links (that wasn't repeatable, so dion't know if fix works).
Diffstat (limited to 'src/client/views/collections/collectionFreeForm')
| -rw-r--r-- | src/client/views/collections/collectionFreeForm/CollectionFreeFormLinkView.tsx | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormLinkView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormLinkView.tsx index f051d5f8d..4cf257640 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormLinkView.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormLinkView.tsx @@ -100,13 +100,15 @@ export class CollectionFreeFormLinkView extends React.Component<CollectionFreeFo let rect = el.getBoundingClientRect(); const top = rect.top, height = rect.height; var el = el.parentNode; - do { - rect = el.getBoundingClientRect(); - if (top <= rect.bottom === false && getComputedStyle(el).overflow === "hidden") return rect.bottom; - // Check if the element is out of view due to a container scrolling - if ((top + height) <= rect.top && getComputedStyle(el).overflow === "hidden") return rect.top; + while (el && el !== document.body) { + if (el.hasOwnProperty("getBoundingClientRect")) { + rect = el.getBoundingClientRect(); + if (top <= rect.bottom === false && getComputedStyle(el).overflow === "hidden") return rect.bottom; + // Check if the element is out of view due to a container scrolling + if ((top + height) <= rect.top && getComputedStyle(el).overflow === "hidden") return rect.top; + } el = el.parentNode; - } while (el !== document.body); + } // Check its within the document viewport return top; //top <= document.documentElement.clientHeight && getComputedStyle(document.documentElement).overflow === "hidden"; } @@ -114,13 +116,15 @@ export class CollectionFreeFormLinkView extends React.Component<CollectionFreeFo let rect = el.getBoundingClientRect(); const left = rect.left, width = rect.width; var el = el.parentNode; - do { - rect = el.getBoundingClientRect(); - if (left <= rect.right === false && getComputedStyle(el).overflow === "hidden") return rect.right; - // Check if the element is out of view due to a container scrolling - if ((left + width) <= rect.left && getComputedStyle(el).overflow === "hidden") return rect.left; + while (el && el !== document.body) { + if (el.hasOwnProperty("getBoundingClientRect")) { + rect = el.getBoundingClientRect(); + if (left <= rect.right === false && getComputedStyle(el).overflow === "hidden") return rect.right; + // Check if the element is out of view due to a container scrolling + if ((left + width) <= rect.left && getComputedStyle(el).overflow === "hidden") return rect.left; + } el = el.parentNode; - } while (el !== document.body); + } // Check its within the document viewport return left; //top <= document.documentElement.clientHeight && getComputedStyle(document.documentElement).overflow === "hidden"; } |
