MOBILE-2335 contextmenu: Sort context menu items

main
Dani Palou 2018-02-02 13:23:29 +01:00
parent e8cbead5d6
commit 6af7e4195d
2 changed files with 6 additions and 1 deletions

View File

@ -43,6 +43,11 @@ export class CoreContextMenuComponent implements OnInit {
this.hideMenu = !this.items.some((item) => { this.hideMenu = !this.items.some((item) => {
return !item.hidden; return !item.hidden;
}); });
// Sort the items by priority.
this.items.sort((a, b) => {
return a.priority <= b.priority ? 1 : -1;
});
}); });
} }

View File

@ -301,7 +301,7 @@ export class CoreContentLinksDelegate {
// Sort by priority. // Sort by priority.
actions = actions.sort((a, b) => { actions = actions.sort((a, b) => {
return a.priority >= b.priority ? 1 : -1; return a.priority <= b.priority ? 1 : -1;
}); });
// Fill result array. // Fill result array.