From 5e19a37df7d0c7409d99f0c5c8575c2b7adcf878 Mon Sep 17 00:00:00 2001 From: zadam Date: Fri, 28 May 2021 23:21:55 +0200 Subject: [PATCH] fix rendering --- .../widgets/type_property_widgets/link_map.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/public/app/widgets/type_property_widgets/link_map.js b/src/public/app/widgets/type_property_widgets/link_map.js index 1822ef40e..6d4d65ad7 100644 --- a/src/public/app/widgets/type_property_widgets/link_map.js +++ b/src/public/app/widgets/type_property_widgets/link_map.js @@ -29,6 +29,22 @@ export default class LinkMapWidget extends NoteContextAwareWidget { } async refreshWithNote(note) { + let shown = false; + + const observer = new IntersectionObserver(entries => { + if (!shown && entries[0].isIntersecting) { + shown = true; + this.displayLinkMap(note); + } + }, { + rootMargin: '0px', + threshold: 0.1 + }); + + observer.observe(this.$widget[0]); + } + + async displayLinkMap(note) { this.$widget.html(TPL); const $linkMapContainer = this.$widget.find('.link-map-container');