Answer the question
In order to leave comments, you need to log in
How to save cursor position in textarea when focus is lost?
When editing, you need to insert an element into the teatarea form with text by selecting it from another selected form (click on selected and certain text is inserted into the textarea).
The problem is that when I select an element to paste, the focus disappears from the textarea, the cursor position is lost, and the paste only occurs at the end of the text. (And I need to paste where the cursor was)
How can I make sure that the paste is at the last position? Pass textarea.selectionEnd? How exactly can it be used in a method?
addExpression(index, value){
let withCondition = this.state.step.text ? this.state.step.text : ' ';
withCondition = (with.Condition + value);
this.setState({step: {...this.state.step, text: withCondition}}, () => {
this.saveChanges();
this.props.changedModified(true);
})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question