quill
quill copied to clipboard
How to get the position of the cursor on the screen?
I need the height to grow automatically while keeping the cursor in the viewing area,But I don't know if I can make it happen🙏🙏🙏
There is a cursor blot in quill core. You can use like this:
findCursorPosition(index){
this.quill.insertEmbed(index, 'cursor', {}, Quill.sources.SILENT); // Create cursor blot at your desired index (your current index)
const cursor = document.querySelector('.ql-cursor'); // Find cursor element
if(cursor) {
console.log(cursor.getBoundingClientRect()); // Get position
cursor.remove(); // Remove cursor
}
}
https://quilljs.com/docs/api/