diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/application/umbcontextmenu.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/application/umbcontextmenu.directive.js index f666e6258789..2fcc295a0557 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/application/umbcontextmenu.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/application/umbcontextmenu.directive.js @@ -7,7 +7,7 @@ * Handles the click events on the context menu **/ angular.module("umbraco.directives") -.directive('umbContextMenu', function (navigationService, keyboardService, backdropService) { +.directive('umbContextMenu', function (navigationService, keyboardService) { return { scope: { menuDialogTitle: "@", @@ -20,22 +20,27 @@ angular.module("umbraco.directives") templateUrl: 'views/components/application/umb-contextmenu.html', link: function (scope, element, attrs, ctrl) { + // Map action icons using legacy icon font or svg icons. + Utilities.forEach(scope.menuActions, action => { + action.icon = (action.useLegacyIcon ? 'icon-' : '') + action.icon; + }); + //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) { + scope.executeMenuItem = action => { navigationService.executeMenuAction(action, scope.currentNode, scope.currentSection); }; - scope.outSideClick = function() { + scope.outSideClick = () => { navigationService.hideNavigation(); }; - keyboardService.bind("esc", function() { + keyboardService.bind("esc", () => { navigationService.hideNavigation(); }); //ensure to unregister from all events! - scope.$on('$destroy', function () { + scope.$on('$destroy', () => { keyboardService.unbind("esc"); }); } 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 281a52e4e505..54756ee213e1 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 @@ -1,7 +1,7 @@ (function () { 'use strict'; - function EditorMenuDirective($injector, treeService, navigationService, umbModelMapper, appState) { + function EditorMenuDirective(treeService, navigationService, appState) { function link(scope, el, attr, ctrl) { @@ -11,13 +11,17 @@ function onInit() { - getOptions(); + // Map action icons using legacy icon font or svg icons. + Utilities.forEach(scope.actions, action => { + action.icon = (action.useLegacyIcon ? 'icon-' : '') + action.icon; + }); + getOptions(); } //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) { + scope.executeMenuItem = 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) @@ -35,14 +39,13 @@ if (!scope.actions) { treeService.getMenu({ treeNode: scope.currentNode }) - .then(function (data) { + .then(data => { scope.actions = data.menuItems; }); } }; onInit(); - } var directive = { diff --git a/src/Umbraco.Web.UI.Client/src/views/components/application/umb-contextmenu.html b/src/Umbraco.Web.UI.Client/src/views/components/application/umb-contextmenu.html index 107103b1b40c..cee9da9ebc28 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/application/umb-contextmenu.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/application/umb-contextmenu.html @@ -14,7 +14,7 @@