use-editable icon indicating copy to clipboard operation
use-editable copied to clipboard

Feature Request: Select All

Open ergodic1 opened this issue 3 years ago • 3 comments

Thanks for the great library.

Is it possible to expose selectall functionality? I can achieve this by using the following on click, but it seems like programmatic control over range selections is possible with the library.

document.execCommand("selectAll", false, undefined);

Something like Edit.select(range)?

ergodic1 avatar Jul 24 '21 02:07 ergodic1

I'm a little hesitant to include this. The logic exists but you have found a valid way to select all content natively without any quirks that need to be smoothed over.

In general, I'm struggling to find use-cases for selecting a specific range beyond selecting everything, which is easily possible. I think selecting a specific range may not be a common use-case. I can be convinced otherwise, but currently I'm on the fence on implementing this 😅

kitten avatar Jul 24 '21 12:07 kitten

The reason select all might want to be included is that while the above "works", it's a little buggy in terms of UX and I'm not sure we could rely on it to work in a production setting. The execcommand's success relies on the field being the currently focused field, and if there are other ui updates scheduled (popups etc, other events) then I've noticed just in dev mode it's behavior isn't reliable.

ergodic1 avatar Jul 24 '21 22:07 ergodic1

I also have a need for this, and am reluctant to use document.execCommand because it's deprecated.

zane avatar Jun 22 '22 02:06 zane