From 855d119587a9cc1c591a1de511d25d109edd0d7b Mon Sep 17 00:00:00 2001 From: Alexander Schlemmer <alexander@mail-schlemmer.de> Date: Mon, 22 Feb 2021 17:59:52 +0000 Subject: [PATCH] FIX: bottom line now also works for entities larger than viewport --- CHANGELOG.md | 2 ++ src/core/js/ext_bottom_line.js | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b79c4b37..acb0bb15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -65,6 +65,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - summaries when opening preview - #125 special characters like "\t", \"n", "#" are replaced in table download +- #158 show preview if the entity is too large for the viewport if + bottom line is in view. ### Security (in case of vulnerabilities) diff --git a/src/core/js/ext_bottom_line.js b/src/core/js/ext_bottom_line.js index e09ee3d6..51ca8ac9 100644 --- a/src/core/js/ext_bottom_line.js +++ b/src/core/js/ext_bottom_line.js @@ -68,6 +68,19 @@ * @requires ext_table_preview (module from ext_table_preview.js) */ +/** + * Helper function analogous to ext_references isOutOfViewport + * + * Check whether the bottom of an entity is within the viewport. + * Returns true when this is the case and false otherwise. + * + */ +function is_bottom_in_viewport(entity) { + var bounding = entity.getBoundingClientRect(); + return bounding.bottom > 0 && bounding.bottom < (window.innerHeight || + document.documentElement.clientHeight); +} + var ext_bottom_line = function($, logger, is_in_view_port, load_config, getEntityPath, connection, UTIF, ext_table_preview) { /** @@ -568,7 +581,7 @@ var ext_bottom_line = function($, logger, is_in_view_port, load_config, getEntit BottomLineWarning: BottomLineWarning, } }($, log.getLogger("ext_bottom_line"), - resolve_references.is_in_viewport_vertically, load_config, getEntityPath, + is_bottom_in_viewport, load_config, getEntityPath, connection, UTIF, ext_table_preview); -- GitLab