MOBILE-2335 contextmenu: Sort context menu items
parent
e8cbead5d6
commit
6af7e4195d
|
@ -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;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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.
|
||||||
|
|
Loading…
Reference in New Issue