I have angular form textarea
<textarea class="form-control"
id="message"
formControlName="message"
(focus)="onFocusEvent($event)"
></textarea>
and button that add text to the end of
<button (click)=addText()></button>
addText() {
const customText: string = 'customText';
this.form.setValue({message: this.form.get('message').value + '\n' + customText});
}
I'd like to add customText to place based on where mouse is located on now. How can I determine that place? possible using onFocus event?
Determining the mouse position is easy with Rxjs. Look at the following example:
After this, you can create a method that determines the message to display based on the mouse result.
I hope this helps.