Wikimedia Developer Support

VisualEditor text styling inspector

We are trying to implement a dynamic inspector that would offer a couple of basic text styling options when user selects the text.
Popup would appear when text is selected and annotations would be inserted after the user selects something in the popup.

What is the good way to listen for surface changes to detect text selection?