This discussion has a nice solution for @mention feature for vision, I'm now looking for something similar in Perspective—any way we can do that too?
I have found the nearest solution for this, But still if you see the popup with dropdown is not opening near the cursor, Instead it opens as usual popup opens in the center.
You should try using a contextMenu
. It exists on perspective components under meta
.
Perspective Component Properties | Ignition User Manual
I was looking for context menu, But it is like, I can able to open only on right kouse click of the component. I need something like in the image. To find a cursor and to the dropdown popup near the text area component cursor.
You can manually display/hide a context menu with self.requestContextMenu()
and self.removeContextMenu()
. There is still a problem since these methods do not include x,y params. It will always open from the component's center.
You can move it with a style transform, but I haven't found a way to do it consistently in the correct location since css units like vh,vmax,vw, etc
reference the context menu itself, and not the text component. transform: translateX(value)
if event.shiftKey and event.key == '@':
self.requestContextMenu()