react-contenteditable icon indicating copy to clipboard operation
react-contenteditable copied to clipboard

expose props API to enable selection range get & set

Open ibarapascal opened this issue 3 years ago • 1 comments

as title

current

currently, I guess it's not supported to customize the selectionRange to the contentEditable element.

ref.current.setSelectionRange(4, 6);

there are some cases like inserting some text to replace the current cursor's selected content as well as keeping the after cursor position at the addition end programmatically (controlled, bound with onChange handler).

enhancement

since we do have the method to manually get & set the range via the API, it would be much more convenient to do so with an exposed props API with the related function included.

related QA: https://stackoverflow.com/questions/6249095/how-to-set-the-caret-cursor-position-in-a-contenteditable-element-div

ibarapascal avatar Mar 01 '22 08:03 ibarapascal

@team please add this feature

mahmedmushtaq avatar Sep 23 '22 13:09 mahmedmushtaq