Open caasi opened 5 years ago
Current code will fallback to this.quill.getLength() when you move your cursor to the beginning of content.
this.quill.getLength()
insert(dataUrl) { const index = (this.quill.getSelection() || {}).index || this.quill.getLength(); this.quill.insertEmbed(index, 'image', dataUrl, 'user'); }
Check the result of getSelection may be a better solution.
getSelection
insert(dataUrl) { const selection = this.quill.getSelection(); const index = selection ? selection.index : this.quill.getLength(); this.quill.insertEmbed(index, 'image', dataUrl, 'user'); }
@caasi Good job, You should give a PR to this project.
Current code will fallback to
this.quill.getLength()
when you move your cursor to the beginning of content.Check the result of
getSelection
may be a better solution.