fabricjs / fabric.js

Javascript Canvas Library, SVG-to-Canvas (& canvas-to-SVG) Parser
http://fabricjs.com
Other
28.93k stars 3.51k forks source link

Copy/Pasting text on touch devices #6059

Open melchiar opened 4 years ago

melchiar commented 4 years ago

Is your feature request related to a problem? Please describe. Some of our site's users are struggling with the lack of working copy/paste functionality for textboxes on touch devices. Unlike desktops where keyboard shortcuts are an option, mobile users are restricted to touch input for triggering copy/paste functionality.

Describe the solution you'd like Ideally, textboxes within a Fabric JS canvas should have similar functionality to standard DOM text elements where longpressing a word or sentence triggers the copy/paste menu on mobile devices. Obviously fabric text objects are not typical DOM text objects so I'm not even sure if such a solution is possible.

Describe alternatives you've considered Another option I suppose would be to add a UI component where the contents of a textbox is shown inside a separate text input and text can be copied/pasted from there. This is far from an elegant solution, and in in-canvas solution would be preferable.

Has anyone else struggled with this issue?

asturur commented 4 years ago

touch events are at the center of attention right now. I m working on a official guide to integrate with hammerjs.

Something we could do and that should not hurt anyone is to move the text selection change on mouseup rather than mousedown. That would allow for a longtap to trigger.

i would exclude the possibility to custom ui elements but the new control interface that i will release would allow you to have a specific control that copy the selected text. This is also a cool example for the docs.

melchiar commented 4 years ago

Exciting news! 👍

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

marina31714 commented 2 years ago

Hello,

Is there any news about this? I am having the same problem.

What could be an alternative solution otherwise?

ShaMan123 commented 2 years ago

@melchiar is this still an issue? #7802 should/could cover this

melchiar commented 2 years ago

Yes, this is still an issue.

I've given #7802 a quick test on my android phone and the draggable text changes don't appear to make a difference since the ability to copy/paste on a touch device is dependent on being able to trigger the native context menu. From what I can tell this can't be done programmatically so I believe a proper solution would require forcing the text interactions to occur with a textarea