ScratchAddons icon indicating copy to clipboard operation
ScratchAddons copied to clipboard

Support multiselect on `better-quoter` (if possible)

Open OneShot-Niko opened this issue 2 years ago • 5 comments

Why this would be helpful

Firefox & other gecko based browsers have integrated multiselect (highlight something, ctrl and highlight something else - Unsure if chromium can replicate in any way), this is pretty useful and would be especially useful on the forums, seperating sentences in quotes just to focus on one thing (prime example - Forums are down so gotta use ocular for this) or replying to multiple posts at once.

Unsure how this could work in Chromium though, letalone detect multiselect.

My suggestion

Support multiselect by quoting them seperately.

If I remember correctly (cannot check at the moment due to forums being down), currently it just picks one of the highlighted text and quotes that. It'd be really nice to be able to quote multiple posts at once with this.

Possible alternatives

  1. don't implement
  2. never implement

I have no ideas for alternatives, besides possibly marking a post as quotable and then adding a quote selected button, though I'm guessing that'd be even harder.

Additional context

no

OneShot-Niko avatar Dec 27 '23 13:12 OneShot-Niko

I started working on this ages ago and then forgot about it. In chromium, it would Just Work:tm: as it does at the moment (ie not supporting multi-select) - iirc the addon currently selects the '0th' selection regardless of browser. The UI could be a bit tricky but tbh anything's better than what we have currently - a floating button above each selectipn like what discourse does would work well I think, although I recall having some difficulty implementing that. But really this'd require very minimal changes to the code.

pufferfish101007 avatar Dec 27 '23 13:12 pufferfish101007

Is this possible with standard browser APIs?

DNin01 avatar Dec 27 '23 19:12 DNin01

Is this possible with standard browser APIs?

Yes. selection.rangeCount returns the number of selected ranges; selection.getRangeAt(n) does what it says on the tin. These are already used in the addon, in addons/better-quoter/module.js#L52-53

pufferfish101007 avatar Dec 28 '23 10:12 pufferfish101007

Is this possible with standard browser APIs?

Yes. selection.rangeCount returns the number of selected ranges; selection.getRangeAt(n) does what it says on the tin. These are already used in the addon, in addons/better-quoter/module.js#L52-53

Looks like it's only reading the first selection. We could use a for loop to get all the selections.

Is it possible for the user to make multiple selections in Chrome, or can you only select one thing at a time? If not, I'd say this has a lower priority.

DNin01 avatar Dec 28 '23 16:12 DNin01

Looks like it's only reading the first selection. We could use a for loop to get all the selections.

Yes.

Is it possible for the user to make multiple selections in Chrome, or can you only select one thing at a time? If not, I'd say this has a lower priority.

Multi-select is a firefox-only feature; other gecko-based browsers allow multi-select over table cells, and chromium only allows 1 Range at a time. Supporting multiple ranges would be very trivial.

pufferfish101007 avatar Dec 28 '23 18:12 pufferfish101007