Refactor menu-row ng-click into action property

This commit is contained in:
Mo Bitar
2018-08-16 09:38:50 -05:00
parent 946ed40623
commit 71f4f9aba1
11 changed files with 51 additions and 36 deletions

View File

@@ -23,7 +23,7 @@ angular.module('app')
}
})
.controller('EditorCtrl', function ($sce, $timeout, authManager, $rootScope, actionsManager, syncManager, modelManager, themeManager, componentManager, storageManager, sessionHistory) {
this.spellcheck = true;
this.componentManager = componentManager;
@@ -366,11 +366,10 @@ angular.module('app')
this.editingName = false;
}
this.selectedMenuItem = function($event, hide) {
this.selectedMenuItem = function(hide) {
if(hide) {
this.showMenu = false;
}
$event.stopPropagation();
}
this.deleteNote = function() {

View File

@@ -282,7 +282,7 @@ angular.module('app')
}.bind(this), 100)
}
this.selectedMenuItem = function($event) {
this.selectedMenuItem = function() {
this.showMenu = false;
}

View File

@@ -61,9 +61,8 @@ class ActionsMenu {
}
return parentAction.subactions.map((subaction) => {
return {
onClick: ($event) => {
onClick: () => {
this.executeAction(subaction, extension, parentAction);
$event.stopPropagation();
},
label: subaction.label,
subtitle: subaction.desc,

View File

@@ -22,8 +22,7 @@ class EditorMenu {
$scope.defaultEditor = $scope.editors.filter((e) => {return e.isDefaultEditor()})[0];
$scope.selectComponent = function($event, component) {
$event.stopPropagation();
$scope.selectComponent = function(component) {
if(component) {
component.conflict_of = null; // clear conflict if applicable
}

View File

@@ -5,6 +5,7 @@ class MenuRow {
this.transclude = true;
this.templateUrl = "directives/menu-row.html";
this.scope = {
action: "&",
circle: "=",
label: "=",
subtitle: "=",
@@ -15,14 +16,27 @@ class MenuRow {
spinnerClass: "=",
subRows: "=",
faded: "=",
desc: "="
desc: "=",
disabled: "="
};
}
controller($scope, componentManager) {
'ngInject';
$scope.onClick = function($event) {
if($scope.disabled) {
return;
}
$event.stopPropagation();
$scope.action();
}
// This is for the accessory button
$scope.clickButton = function($event) {
if($scope.disabled) {
return;
}
$event.stopPropagation();
$scope.buttonAction();
}