From 4b69a7859d426583c9d6e50a2695061ee0178709 Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Sun, 3 Feb 2019 13:56:00 +0100 Subject: [PATCH 1/2] Make sure the app menu state is set --- .../directives/components/editor/umbeditormenu.directive.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditormenu.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditormenu.directive.js index 9dff712ef6..03587186cb 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditormenu.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditormenu.directive.js @@ -30,8 +30,8 @@ } //when the options item is selected, we need to set the current menu item in appState (since this is synonymous with a menu) - // Niels: No i think we are wrong, we should not set the currentNode, cause it represents the currentNode of interaction. - //appState.setMenuState("currentNode", scope.currentNode); + //- otherwise we break any tree dialog that works with the current node (and that's pretty much all of them) + appState.setMenuState("currentNode", scope.currentNode); if (!scope.actions) { treeService.getMenu({ treeNode: scope.currentNode }) From 6141d8840777190f6a06798145b563b04b103dbc Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Sun, 3 Feb 2019 17:05:27 +0100 Subject: [PATCH 2/2] Don't set the menu state until the action is about to be carried out. --- .../components/editor/umbeditormenu.directive.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditormenu.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditormenu.directive.js index 03587186cb..665f315bee 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditormenu.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditormenu.directive.js @@ -18,6 +18,10 @@ //adds a handler to the context menu item click, we need to handle this differently //depending on what the menu item is supposed to do. scope.executeMenuItem = function (action) { + //the action is called as it would be by the tree. to ensure that the action targets the correct node, + //we need to set the current node in appState before calling the action. otherwise we break all actions + //that use the current node (and that's pretty much all of them) + appState.setMenuState("currentNode", scope.currentNode); navigationService.executeMenuAction(action, scope.currentNode, scope.currentSection); scope.dropdown.isOpen = false; }; @@ -29,10 +33,6 @@ return; } - //when the options item is selected, we need to set the current menu item in appState (since this is synonymous with a menu) - //- otherwise we break any tree dialog that works with the current node (and that's pretty much all of them) - appState.setMenuState("currentNode", scope.currentNode); - if (!scope.actions) { treeService.getMenu({ treeNode: scope.currentNode }) .then(function (data) {