Hi,
Nice work. One question:
Is there a way to get the current caret position? Anyhow? Directly, via JavaScript?
The use case would be to split one text out of your rich text editor into two.
Thanks
Hi,
Nice work. One question:
Is there a way to get the current caret position? Anyhow? Directly, via JavaScript?
The use case would be to split one text out of your rich text editor into two.
Thanks
Hey! There is not an official feature for this.
Now, I did some playing around with chrome inspector. There is a protected property named _editor, which has getSelection(giveFocus)
. It returns the index and range, where index is what you are looking for if no text is selected. In Chrome inspector, if I select the <vaadin-rich-text-editor>
element, I can call this:
$0._editor.getText(0,$0._editor.getSelection(true).index)
getSelection
gives the cursor position in plain text, so I used getText
to get the plain text from the component.
This could be an enhancement to create API for in future versions.