[BUGFIX] Register page tree navigation component after it is initialized 43/55043/7
authorTymoteusz Motylewski <t.motylewski@gmail.com>
Tue, 12 Dec 2017 12:13:05 +0000 (13:13 +0100)
committerTymoteusz Motylewski <t.motylewski@gmail.com>
Tue, 12 Dec 2017 15:15:20 +0000 (16:15 +0100)
Now Viewport.NavigationContainer.setComponentInstance(tree);
is called after the tree is initialized.
A check to prevent multiple initialization calls is added.

Also position of the title edit imput is corrected
in case where there are multiple mount points.

Releases: master
Resolves: #83299
Change-Id: I5b9cc14b362ab20ecb7631babe3f3f83eb8bfb48
Reviewed-on: https://review.typo3.org/55043
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Reviewed-by: Frans Saris <franssaris@gmail.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Frans Saris <franssaris@gmail.com>
Reviewed-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Tested-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
typo3/sysext/backend/Resources/Public/JavaScript/PageTree/PageTree.js
typo3/sysext/backend/Resources/Public/JavaScript/PageTree/PageTreeDragDrop.js
typo3/sysext/backend/Resources/Public/JavaScript/PageTree/PageTreeElement.js

index 170c48c..bd247ae 100644 (file)
@@ -412,8 +412,7 @@ define(['jquery',
         .append('input')
         .attr('class', 'node-edit')
         .style('top', function () {
-          var top = _this.data.nodes.indexOf(node) * _this.settings.nodeHeight;
-          top = top + 15; //svg margin top
+          var top = node.y + 15; //svg margin top
           return top + 'px';
         })
         .style('left', (node.x + _this.textPosition + 5) + 'px')
index 66d8ac1..d07b8f1 100644 (file)
@@ -752,8 +752,7 @@ define([
         .append('input')
         .attr('class', 'node-edit')
         .style('top', function () {
-          var top = _this.tree.data.nodes.indexOf(newNode) * _this.tree.settings.nodeHeight;
-          top = top + 15; //svg margin top
+          var top = newNode.y + 15; //svg margin top
           return top + 'px';
         })
         .style('left', (newNode.x + _this.tree.textPosition + 5) + 'px')
index be22f69..a39725a 100644 (file)
@@ -46,25 +46,23 @@ define(['jquery',
      * @param {String} selector
      */
     PageTreeElement.initialize = function (selector) {
-      $(document).ready(function () {
+      $(function () {
         var $element = $(selector);
-        var tree = new PageTree();
 
-        if ($element.html().trim().length === 0) {
-          $element.append(PageTreeElement.template);
+        if ($element.html().trim().length !== 0) {
+          return;
         }
 
-        if ($('.node-loader').html().trim().length === 0) {
-          Icons.getIcon('spinner-circle-light', Icons.sizes.small).done(function (spinner) {
-            $('.node-loader').append(spinner);
-          });
-        }
+        var tree = new PageTree();
+        $element.append(PageTreeElement.template);
 
-        if ($('.svg-tree-loader').html().trim().length === 0) {
-          Icons.getIcon('spinner-circle-light', Icons.sizes.large).done(function (spinner) {
-            $('.svg-tree-loader').append(spinner);
-          });
-        }
+        Icons.getIcon('spinner-circle-light', Icons.sizes.small).done(function (spinner) {
+          $('.node-loader').append(spinner);
+        });
+
+        Icons.getIcon('spinner-circle-light', Icons.sizes.large).done(function (spinner) {
+          $('.svg-tree-loader').append(spinner);
+        });
 
         var dataUrl = top.TYPO3.settings.ajaxUrls.page_tree_data;
         var configurationUrl = top.TYPO3.settings.ajaxUrls.page_tree_configuration;
@@ -74,9 +72,9 @@ define(['jquery',
             dataUrl: dataUrl,
             showIcons: true,
           }));
-        });
 
-        Viewport.NavigationContainer.setComponentInstance(tree);
+          Viewport.NavigationContainer.setComponentInstance(tree);
+        });
 
         if (!$('#svg-toolbar').data('tree-show-toolbar')) {
           var pageTreeToolbar = new PageTreeToolbar();