Refactor menu-row ng-click into action property
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -282,7 +282,7 @@ angular.module('app')
|
||||
}.bind(this), 100)
|
||||
}
|
||||
|
||||
this.selectedMenuItem = function($event) {
|
||||
this.selectedMenuItem = function() {
|
||||
this.showMenu = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user