I am using Fabric.js in an Angular application and trying to implement copy-paste functionality for text inside a Textbox. However, I am facing the following issues:
Fabric.js does not provide a direct event for text selection inside a Textbox.
Copy (Ctrl + C) and Paste (Ctrl + V) are not working correctly:
I want to copy only the selected portion of text inside a another Textbox.
I want to paste the copied text at the cursor position inside another Textbox.
There is no built-in event like selection:changed or text:selection in Fabric.js, so I am unable to detect where the user selected text.
What I Tried: I attempted to use selection:created and selection:updated, but these events only work when selecting an entire object, not when selecting part of the text inside a Textbox.
I tried using text:changed, but this only fires when text content is modified, not when selecting text.
I have also tried selection:changed event but in this can not got any event as param so can not find which text user will select.
Questions:
- How can I detect when a user selects part of a text inside a Fabric.js Textbox?
- How can I correctly copy-paste text inside a Fabric.js Textbox at the right position?
- Is there a workaround or a reliable way to get selectionStart and selectionEnd inside a Fabric.js Textbox?
Any help or suggestions would be appreciated!