You might’ve seen this feature in many online editors or blogs, where, when you select some text on the page, a menu appears near the selection, showing options to format or share the selected text.
In my demo, I’ve created something similar: on selecting text, a button appears near the selection, on clicking which you‘ll be prompted to tweet the selected text.