This internal JavaScript code provides functionality for text selection, popup menus, and interactive UI elements in the text annotation interface. It manages mouse events for text selection, highlighting, and code application.
A character string containing JavaScript code
Text selection events (mousedown, mousemove, mouseup)
Popup menu events for code operations
Custom Shiny message handlers for selection state
The JavaScript code implements the following functionality:
Creation and management of popup menus for code operations
Text selection handling with mouse events
Highlighting of selected text
Communication with Shiny server through custom message handlers
Event handling for code replacement, renaming, and deletion