Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON Viewer - window.getSelection() not returning full text selection for browser extension #257

Open
netbroom opened this issue May 20, 2024 · 1 comment
Labels
feature New feature or request tracked This issue is now tracked on our internal backlog

Comments

@netbroom
Copy link

netbroom commented May 20, 2024

For the JSON viewer, window.getSelection() only returns what is in the user's viewport if a whole JSON document is selected. This is causing problems for our browser extension.

I understand that browser extensions do not have access to the page's JS code so even if window.getSelection() were to be overridden, extensions would not have access.

Copy + paste still works fine if performed by the user, so I'm assuming there is already some interception/override of selection APIs.

AB#51282586

@netbroom netbroom added the bug Something isn't working label May 20, 2024
@captainbrosset
Copy link
Contributor

I think the reason for this is that the JSON viewer is using a web editor JS-based library to render the JSON content. This library optimizes for speed by only rendering to the DOM what can fit in the viewport. Copy/Paste probably works thanks to the library too.
But I'm afraid getting the JSON by querying the DOM won't work, because the content is just not there entirely.

We have already received a request to expose the entire JSON data to the page context. So, for example, you could do window.jsonData and get the entire JSON object. I guess this would help you in your case.

Unfortunately, we've not yet prioritized working on this.

@captainbrosset captainbrosset added feature New feature or request tracked This issue is now tracked on our internal backlog and removed bug Something isn't working labels May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request tracked This issue is now tracked on our internal backlog
Projects
None yet
Development

No branches or pull requests

2 participants