Skip to main content
Known Participant
June 21, 2010
Question

How to modify contextMenu for LinkElement only?

  • June 21, 2010
  • 1 reply
  • 668 views

I want to modify the default contextMenu for LinkElement only.

I think that I might do this by overriding ContainerController.menuSelectHandler() method. But how can i know what kind of element was being right-clicked?  I just want add some contextMenuItem to when user click LinkElement.

Thanks.

This topic has been closed for replies.

1 reply

Adobe Employee
June 21, 2010

This formula should work with some adjusments (I didn't try it):  In your ContainerController.menuSelectHandler override container.mouseX and container.mouseY contain the mouse position.  From that use static SelectionManager method computeSelectionIndex(textFlow, container, container, container.mouseX, container.mouseY) to compute an index in the TextFlow.  computeSelectionIndex is in the tlf_internal namespace and is not documented.  Then use textFlow.findleaf(index) to find the leaf element.  Check the returned leaf's parents to see if its in a LinkElement and customize your contextMenu as desired.

Hope that helps,

Richard

fatmckAuthor
Known Participant
June 22, 2010

Thanks a lot, it seems to be a little complicated..I'll try.