[BUGFIX] Add correct context to page tree context menu 42/56342/3
authorTymoteusz Motylewski <t.motylewski@gmail.com>
Sun, 18 Mar 2018 08:56:29 +0000 (09:56 +0100)
committerAndreas Fernandez <a.fernandez@scripting-base.de>
Mon, 19 Mar 2018 18:37:57 +0000 (19:37 +0100)
In order to allow user to disable context menu items for certain context,
e.g. page tree, page tree need to correctly pass the context to the JS.

As SvgTree doesnt support context menu, the code is moved to the PageTree.js
Also a bug in the changelog documentation is fixed.

Releases: master, 8.7
Resolves: #84017
Change-Id: I4c3b51aa50d1750b86391342ba45aaec00c70a10
Reviewed-on: https://review.typo3.org/56342
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Łukasz Uznański <l.uznanski@macopedia.pl>
Reviewed-by: Tobi Kretschmann <tobi@tobishome.de>
Reviewed-by: Paweł Rogowicz <rogowicz.pawel@gmail.com>
Tested-by: Paweł Rogowicz <rogowicz.pawel@gmail.com>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
typo3/sysext/backend/Resources/Public/JavaScript/PageTree/PageTree.js
typo3/sysext/backend/Resources/Public/JavaScript/SvgTree.js
typo3/sysext/core/Documentation/Changelog/8.6/Breaking-78192-RefactorClickMenuContextMenu.rst

index 1f15783..c53d3b9 100644 (file)
@@ -229,7 +229,8 @@ define(['jquery',
     PageTree.prototype.updateSvg = function(nodeEnter) {
       nodeEnter
         .select('use')
-        .attr('data-table', 'pages');
+        .attr('data-table', 'pages')
+        .attr('data-context', 'tree');
     };
 
     PageTree.prototype.hideChildren = function(node) {
@@ -250,7 +251,12 @@ define(['jquery',
       var _this = this;
 
       nodes = _super_.nodesUpdate.call(this, nodes)
-        .call(this.dragDrop.drag());
+        .call(this.dragDrop.drag())
+        .attr('data-table', 'pages')
+        .attr('data-context', 'tree')
+        .on('contextmenu', function(node) {
+          _this.dispatch.call('nodeRightClick', node, this);
+        });
 
       var nodeStop = nodes
         .append('text')
index 8510921..dff70fc 100644 (file)
@@ -800,7 +800,6 @@ define(
           .append('g')
           .attr('class', this.getNodeClass)
           .attr('transform', this.getNodeTransform)
-          .attr('data-table', 'pages')
           .attr('data-state-id', this.getNodeStateIdentifier)
           .attr('title', this.getNodeTitle)
           .on('mouseover', function(node) {
@@ -808,9 +807,6 @@ define(
           })
           .on('mouseout', function(node) {
             _this.nodeBgEvents().mouseOut(node, this);
-          })
-          .on('contextmenu', function(node) {
-            _this.dispatch.call('nodeRightClick', node, this);
           });
 
         var nodeStop = nodes
index 6ab2222..91a4207 100644 (file)
@@ -59,10 +59,13 @@ Migration
 
 Migrate TSConfig from:
 
-:typoscript:`options.contextMenu.folderList.disableItems` to :typoscript:`options.contextMenu.sys_file.disableItems`
-:typoscript:`options.contextMenu.folderTree.disableItems` to :typoscript:`options.contextMenu.sys_file.tree.disableItems`
-:typoscript:`options.contextMenu.pageList.disableItems` to :typoscript:`options.contextMenu.pages.disableItems`
-:typoscript:`options.contextMenu.pageTree.disableItems` to :typoscript:`options.contextMenu.pages.tree.disableItems`
+:typoscript:`options.contextMenu.folderList.disableItems` to :typoscript:`options.contextMenu.table.sys_file.disableItems`
+
+:typoscript:`options.contextMenu.folderTree.disableItems` to :typoscript:`options.contextMenu.table.sys_file.tree.disableItems`
+
+:typoscript:`options.contextMenu.pageList.disableItems` to :typoscript:`options.contextMenu.table.pages.disableItems`
+
+:typoscript:`options.contextMenu.pageTree.disableItems` to :typoscript:`options.contextMenu.table.pages.tree.disableItems`
 
 
 
@@ -123,4 +126,4 @@ Migration
 Adapt your code to the new click menu API.
 
 
-.. index:: Backend, JavaScript, PHP-API, TSConfig
\ No newline at end of file
+.. index:: Backend, JavaScript, PHP-API, TSConfig