For inventory context menus PLEASE PLEASE PLEASE use LibCustomMenu (
https://www.esoui.com/downloads/info...ustomMenu.html) to assure it does not throw any security related errors anymore and all other addons work properly!
And do not prehook any context menu stuff but use the RegisterContextMenu functions of the librray! See the lib documentation for further details please, search at teh description for "lib:RegisterContextMenu".
Edit:
Benefit is also that the lib will provide some functions like register a context menu for normal right click and for right click + mopdifier key (alt, shift, ctrl).
Other addons already use their own ways toa chieve this like FCOItemSaver does with SHIFT+RIGHT click. This will make them all work properly together and NOT show any contextmenus where they are not wanted to be shown (e.g. clicked right+shift = show a 2nd context menu and not the normal one -> Your prehook would destroy this or show the normal context menu entries then as well).
For the chat it's posible as well, and you also should use AddCustomMenuEntry of LibCustomMenu here. Let me find an example from my WishList addon e.g.
Lua Code:
local function linkContextMenu(link, button, _, _, linkType, ...)
if button == MOUSE_BUTTON_INDEX_RIGHT and linkType == ITEM_LINK_TYPE then
local itemType = GetItemLinkItemType(link)
...
AddCustomMenuEntry(...)
end
end
--Link handler (for right clicking an item in chat, etc.)
LINK_HANDLER:RegisterCallback(LINK_HANDLER.LINK_MOUSE_UP_EVENT, linkContextMenu)