TextField selection ( dynamic )

Hi. What’s about copy selected text ? In Desktop or mobile (long tap) - right click, no value copy appeared.

What can I do ?

It should be possible to copy using keyboard shortcuts, or manually triggering the clipboard class, but the issue is that since it’s a simulated text input, it does not trigger the browser’s native right-click menu

Its really bad news ((( is that planned in future builds?

I’m not sure how we can solve this, but open to ideas.

The DOM target does support native text input, but HTML5 support for adding right-click context menu items was deprecated and is not support by anything but Firefox I think

Ok in Desktop - we can use ctrl+c shortcut, but what about mobile? If no ideas its very bad for textBlock sites. How i can copy email for example or telephone number on mobile target without selection support? (html5 target)

Open to ideas! A fake right-click menu is one idea, or maybe there are ways to trick the browser into thinking it’s editing a text field.

This post provides a useful snippet that should do what you want. Its fallback plan (create a temporary text field and copy from there) is clunky but ought to work in any browser.

Either include that snippet in a separate .js file, or embed it as raw JavaScript. Then add a button to your app and run the snippet when the user clicks.

I think, its possible copy to clipBoard by using Clipboard class without buttons and others, in my case, i want to show browser iteraction on textField. For example in Safari - tap two fingers - show native browser buttons : copy, edit, send, and select part of text. Or interesting fact - Chrome can translate page to u language, but in openfl - its impossible to do i think. So - the problem is CANVAS. Canvas is a GFX such as Bitmap layer, so all of assets inner makes as bitmap, i mean.

Does your project work in -Ddom?

no, in canvas mode. In dom many features works badly or never works;

For example : I have a textField - width such as 200 px. has htmlText. In trace Dcanvas I see 200 px, but in Ddom 2267 px. Why&! and so on, dDom works with a lot of bugs

PiratePig works fine, but I can’t promise DOM is perfect everywhere, it’s not heavily used, though we do use it for openfl.org/learn tutorials

singmajesty - big stack of problem’s in DOM is - textField operation, and some in BitmapData operation, others features works fine. Actuate works, displaing DisplayObject works, coords, scale, and so on works fine, but textFields and BitmapData - bugged.

I can show example:

    		this._tf1.htmlText = "<font color='#990000'>" + headText.split(" ")[0] 
    		+ "</font><font color='#ff0000'> I </font><font color='#32ABAB'>" + headText.split(" ")[1] + "</font>";

-show me 2267 px width. The TF think width as HTMLtags as full of text in DOM, in Canvas - that ok