0

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:

  1. How can I detect when a user selects part of a text inside a Fabric.js Textbox?
  2. How can I correctly copy-paste text inside a Fabric.js Textbox at the right position?
  3. 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!

1
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Commented Mar 27 at 9:47

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.