Hello team, is there a standard way or a library ...
# multiplatform
x
Hello team, is there a standard way or a library to read/write the clipboard in KMP? I already know how to do it in Android/JVM but looking to do it on native (linux /macOS) as well.
p
I have been using this on the web:
Copy code
@Composable
fun ClipBoardPasteButton(
    onPaste: (String) -> Unit
) {
    // val clipboardManager = LocalClipboardManager.current
    val clipboardManager = window.navigator.clipboard

    Button(onClick = {
        clipboardManager.readText().then {
            onPaste(it)
        }
    }) {
        Text("Paste from Clipboard")
    }
}
🙏 2