Closed kristofa closed 5 years ago
What prevents me from merging this is that the selected text gets deselected once I press the 'bookmarker for pinboard' toolbar button. This means the feature doesn't work.
This doesn't happen with other extensions like for example when I press the 1Password toolbar button. But I don't know why.
The weird thing is that I got it to work when try it out after showing the Javascript console. When the Javascript console is visible and I select text in the active webpage, the text doesn't get deselected when I press the 'bookmarker for pinboard' toolbar button. In that case the selected text appears in the Description field.
We can only merge and release this once we can prevent selected text from getting deselected when pressing the toolbar button. Any help is appreciated.
An alternative approach would be to try to store the selected text in a variable as soon as it is selected and passing the content of the variable to the extension. However that would be a workaround, not my preferred option.
An alternative approach would be to try to store the selected text in a variable as soon as it is selected and passing the content of the variable to the extension. However that would be a workaround, not my preferred option.
Imo I think this is the way to go.
@apas Yes, I implemented the workaround and got it to work. It wasn't straightforward, details in code comments (script.js) and commit message.
This implements #7.
When the popup opens we get the selected text from the active page and use it to populate the description field. This is implemented by sending messages between the app extension and a script that's injected in the web page.