Add action to open reusabel context menu

Signed-off-by: Ajay Bura <ajbura@gmail.com>
This commit is contained in:
Ajay Bura 2022-01-11 20:46:41 +05:30
parent a2eb9734f1
commit a279995982
3 changed files with 19 additions and 0 deletions

View file

@ -110,3 +110,12 @@ export function openSearch(term) {
term,
});
}
export function openReusableContextMenu(placement, cords, render) {
appDispatcher.dispatch({
type: cons.actions.navigation.OPEN_REUSABLE_CONTEXT_MENU,
placement,
cords,
render,
});
}

View file

@ -42,6 +42,7 @@ const cons = {
OPEN_ROOMOPTIONS: 'OPEN_ROOMOPTIONS',
CLICK_REPLY_TO: 'CLICK_REPLY_TO',
OPEN_SEARCH: 'OPEN_SEARCH',
OPEN_REUSABLE_CONTEXT_MENU: 'OPEN_REUSABLE_CONTEXT_MENU',
},
room: {
JOIN: 'JOIN',
@ -78,6 +79,7 @@ const cons = {
ROOMOPTIONS_OPENED: 'ROOMOPTIONS_OPENED',
REPLY_TO_CLICKED: 'REPLY_TO_CLICKED',
SEARCH_OPENED: 'SEARCH_OPENED',
REUSABLE_CONTEXT_MENU_OPENED: 'REUSABLE_CONTEXT_MENU_OPENED',
},
roomList: {
ROOMLIST_UPDATED: 'ROOMLIST_UPDATED',

View file

@ -147,6 +147,14 @@ class Navigation extends EventEmitter {
action.term,
);
},
[cons.actions.navigation.OPEN_REUSABLE_CONTEXT_MENU]: () => {
this.emit(
cons.events.navigation.REUSABLE_CONTEXT_MENU_OPENED,
action.placement,
action.cords,
action.render,
);
},
};
actions[action.type]?.();
}