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

Copy arbitrary text from webpage #26

Open
richardmcmillen opened this issue Jun 10, 2022 · 3 comments
Open

Copy arbitrary text from webpage #26

richardmcmillen opened this issue Jun 10, 2022 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@richardmcmillen
Copy link
Contributor

richardmcmillen commented Jun 10, 2022

This has been mentioned a few times in Slack I think but thought it wise to get an issue open for discussion and ideas!!

Usecase

Being able to fluently copy portions of a webpage to the clipboard.

Possible Issues

  1. Given the problems described in Links which copy things to clipboard don't always work due to lack of user activation #18 do you know if there will be issues copying portions of the webpage to the clipboard?
  2. Performance, marking up even more of the page could be quite the performance hit.
  3. How to know what characters/words/tokens are visible in the viewport - this seems difficult to do performatively, or at all.

Ideas

Here are some ideas about how to reference areas of a webpage:

  • Cusorless is the obvious example here. This does seem like a significant amount of work though and in the interest of thinking of other interactions lets continue...
  • Referencing words in the current viewport literally, for text The quick brown fox jumps over the lazy dog, take quick past fox to select/copy quick brown fox
  • Copying/selecting lines of text - each line could be marked up with number/letter/color hints
  • Use containing elements like div or other HTML elements (see image below where I added an outline to all div elements)
  • Leveraging the existing vscode draft capability, where you could copy a chunk and then refine more in vscode

Inspiration

A list of some other tools for inspiration:

UX

Perhaps there should be two commands:

  1. Selecting text only - possibly allowing for further refinement
  2. Copy the requested text to clipboard directly.

Given most of the time spent using a web browser would be reading and navigating it seems that any mode that would allow you to copy text would be something that you had to switch into to allow for more markup on the page and actions to become available. Though this would impact the fluency aspect.


image

@david-tejada
Copy link
Owner

Thanks for the issue.

Regarding the possible issues you mention:

  1. Not at all. The reason Links which copy things to clipboard don't always work due to lack of user activation #18 happens is because we are not the ones copying to the clipboard. This happens on click and we don't know when or what will be copied to the clipboard. copy link, for example, should always work and copying other text should follow the same mechanics.
  2. I've improved performance and I think marking the text elements of a page wouldn't have that much more impact. We'll have to see. My only concern is that to know if an element is obscured I use document.elementFromPoint, which is a bit slow. I'll try to optimize as much as I can.
  3. This is easy to do with the Range API. The only difficulty will be getting the character position for input and textarea text since for those elements Range only gives you characters offsets and not position in the viewport.

I think cursorless is the way to go. Maybe your second option of referencing words could be interesting. My only concern would be recognition issues when we have a command like copy (<mark> | <phrase>) past(<mark> | <phrase>).

I think adding a way to show/hide hats will be necessary. Like I intend to do for hints, I think I'll implement a toggle in four levels: Global - > Tab - > Domain - > Path. So Rango will go from left to right and if the user has disabled any of the levels the hints/hats won't show.

@david-tejada
Copy link
Owner

Thinking more about it I think the toggles should be "on", "off" and "auto". That way I could have the marks show for specific pages for example. I'll probably implement that with a true, false, undefined storage variable.

@david-tejada david-tejada added the enhancement New feature or request label Jun 11, 2022
@david-tejada david-tejada self-assigned this Jun 11, 2022
@david-tejada
Copy link
Owner

Depends on #136

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants