[TextEditor] Implemented a more general way to control the tooltip
behavior.