JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.42k stars 1.12k forks source link

Compose for Web: Copy & paste support for TextField #4036

Open StefanOltmann opened 7 months ago

StefanOltmann commented 7 months ago

On the desktop version, there is a context menu offering options such as "cut", "copy", "paste" and "select all" complemented by convenient shortcuts like CMD+C and CMD+V.

It appears that a similar functionality is currently absent in the Compose for Web interface.

terrakok commented 7 months ago

Yes, we are going to support it in the future 👍

usert-4 commented 6 months ago

Hello, @terrakok as we are in the subject of text selection, what about text search browser feature ? for example on Chrome i guess it's text based on html, what about when ui is in a canvas ? could image analyzing/almost ai help here for example for identifying text but it would be on browser side ? and others thing such as when content is out of screen/not drawn, or there are others possible ways for making this work

eymar commented 6 months ago

what about text search browser feature

if this feature becomes available at some point, it probably won't work same way it works in Chrome with html pages.

It's more likely to work like in google docs, and I'd say it's a feature that an app implementation should take care of.

Currently, it's not planned, but can be considered.

usert-4 commented 6 months ago

yes, we could also imagine a system where Compose place html tag informations on the elements in the canvas(location etc..), i also thinked about such thing for debugging/testing purpose, but that's almost another subject that could be seen later, thanks

dhakehurst commented 5 months ago

any idea on the timescale...when will this get supported ?

eymar commented 5 months ago

any idea on the timescale...when will this get supported ?

We aim to make it properly implemented in 1.7 version of Compose Multiplatform.

MahmoudMabrok commented 5 months ago

I think paste not working in web version , I must enter all data, is this issue solved or included in current issue ?

dbaroncelli commented 4 months ago

yes, it's very annoying that cut/paste doesn't work on compose web

Skaldebane commented 3 months ago

@usert-4 Actually that's needed for accessibility as well, so both of these are likely going to be implemented at the same time.

tombaileywzd commented 3 months ago

We aim to make it properly implemented in 1.7 version of Compose Multiplatform.

Just wondering if Hiragana/Katakana support is in scope for the release with cut/copy/paste support? At the moment, Hiragana and Katakana inputs on MacOS show up as Romaji. h + e should become but ends up as he

Schahen commented 3 months ago

@tombaileywzd than you for this report, we haven't tested clipoard events with hiragana/katakana so far, we definitely want to support it (general-purpose framework that does not support Unicode to full extent will be, well, no so general-purpose). As of the actual time framework it's just difficult to estimate. But we'll get there. Also, I'll create a task not to forget add specific test case to cover your scenario.

dmentx commented 5 days ago

Does someone have a workaround?

Skaldebane commented 4 days ago

@Schahen I think this relates to supporting input methods in general. Browsers tell input methods that they do support them (which they do in normal HTML), and so Compose Web has to integrate with that somehow.

Interestingly, Compose Desktop doesn't show the intermediate text and suggestions inline, but it works nevertheless. I may be totally wrong, but I assume this is because Compose Desktop doesn't announce that it supports IMEs at all, and so they work in this sort of fallback mode where the text is prepared in a small system pop-up before inputting the final result into the app. Just a wild guess, I really have no idea how IMEs work, but that's how it behaves on desktop (Linux). This is kind of a separate thing but I just thought it was interesting.

Flutter Web (wasm) seems to support this, and can be tested in any text field in the Material 3 demo: https://flutterweb-wasm.web.app/. There seems to be no Japanese font so it all ends up as tofu (the little squares), but the IME is clearly working and replacing characters inline. Maybe you can draw from their implementation.