AP.host.getSelectedText does not return anything when table is selected

Currently the AP.host.getSelectedText only returns a value if it is plain text, is it possible to obtain the content of a table if the entire table is selected

Hi @adisa.craig,

Currently the AP.host.getSelectedText only returns a value if it is plain text

I don’t think that’s quite right. AP.host.getSelectedText() returns the plain text equivalent of the selected text. For example, if the selection included some bold text, there would be no <b> or <strong> tags in the returned text. If you’re interested, here’s the source code:

https://bitbucket.org/atlassian/atlassian-connect-js/src/76bb704ac9836f9adcf052ad07998ece1bf4467e/src/host/modules/host.js#lines-31

Your request to provide a function that returns a selected table in HTML format seems like it may be a bit specialized and would likely not be prioritized for implementation if I submitted a feature request for it. If you or others can elaborate on the use cases for this then that may help.

Regards,
Dugald

Hi, yes what you are saying is correct, but the case I am referring to, is if an entire table is highlighted, I would’ve expected to get the plain text table content returned but it does not return any value

Hi @adisa.craig,

I’ve built a sample app to test this, but it shows the text of the table is returned by AP.host.getSelectedText(). Try installing https://dx-ap-getselectedtext.glitch.me/ and see if you get the same results as me.

Regards,
Dugald

1 Like