Tracktion / choc

A collection of header only classes, permissively licensed, to provide basic useful tasks with the bare-minimum of dependencies.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cmd+c/cmd+v not working in webview (MacOs)

rorywalsh opened this issue · comments

Default keybindings for copy/paste/cut don't seem to work with the webview on MacOS. As a test you can add a simple <input type="text"> to your page. The same test works fine on Windows. Is there something special that needs to be done to enable this behaviour? I'll dig through the source to see if something obvious jumps out, perhaps it's a known issue?

Been having the same problem too.
I think there are ways to catch the events and use clipboard helpers like writeText to handle clipboard events but obviously would be great if it was directly supported

In my use case I was able to get around the issue by intercepted the key presses on the js side and passing them on to the relevant components, but it's not ideal. I keep my fingers crossed that there is a simple solution thst can be implemented on the choc::webview side. Until now this has been the only real issue I've faced with it.

Thanks - we'll be doing some plugin compatibility work fairly soon, and this is one of the things we'll be checking

Would be eager to get this supported so
I'm trying to add this but I'm no objC expert
From what I understand
you need to add
class_addMethod (webviewClass, sel_registerName ("performKeyEquivalent:"),
in WebviewClass() ctor

and do something similar to
https://stackoverflow.com/questions/970707/cocoa-keyboard-shortcuts-in-dialog-without-an-edit-menu

Any input is welcomed

Thanks !

OK, I've pushed a fix for this now - give it a try!

Works fine now. Thanks a lot !