From e051a5e961a2d2fed95f50ac2871804f0ffc7bfe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20E=C3=9Fl?= <indy.essl@gmail.com>
Date: Sat, 29 Feb 2020 15:51:43 +0100
Subject: [PATCH] [BUGFIX] Show scrollbar earlier in pagetree on larger
 pagetrees

On larger pagetrees, the svg pagetree cut off too many elements at
the bottom and the scrollbar was activated much too late. This was
because the calculated css height of the pagetree could become larger
than the height of the html body itself.
Also redraw the height when the page doktype icon list gets updated.

Resolves: #90555
Resolves: #89193
Releases: master, 9.5
Change-Id: Ice8c46110e2e8c92469a3d2ab12a7744bd6fc7de
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63511
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Riccardo De Contardi <erredeco@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
---
 .../Resources/Public/JavaScript/PageTree/PageTreeToolbar.js     | 1 +
 typo3/sysext/backend/Resources/Public/JavaScript/SvgTree.js     | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/PageTree/PageTreeToolbar.js b/typo3/sysext/backend/Resources/Public/JavaScript/PageTree/PageTreeToolbar.js
index 293056015674..a2ad240a3f01 100644
--- a/typo3/sysext/backend/Resources/Public/JavaScript/PageTree/PageTreeToolbar.js
+++ b/typo3/sysext/backend/Resources/Public/JavaScript/PageTree/PageTreeToolbar.js
@@ -159,6 +159,7 @@ define(['jquery',
 
         Icons.getIcon($this.attr('data-tree-icon'), Icons.sizes.small).then(function(icon) {
           $this.append(icon);
+          _this.tree.setWrapperHeight();
         });
       });
 
diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/SvgTree.js b/typo3/sysext/backend/Resources/Public/JavaScript/SvgTree.js
index 21ea543154ac..22425bd22534 100644
--- a/typo3/sysext/backend/Resources/Public/JavaScript/SvgTree.js
+++ b/typo3/sysext/backend/Resources/Public/JavaScript/SvgTree.js
@@ -397,7 +397,7 @@ define(
        * Set svg wrapper height
        */
       setWrapperHeight: function() {
-        var treeWrapperHeight = ($('#typo3-pagetree').height() - $('#svg-toolbar').height());
+        var treeWrapperHeight = ($('body').height() - $('#svg-toolbar').outerHeight() - $('.scaffold-topbar').height());
         $('#typo3-pagetree-tree').height(treeWrapperHeight);
       },
 
-- 
GitLab