-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Copy Paste (Clipboard) Keyboard Shortcut Issue #1055
Comments
Hmm I thought webview/webview#405 would fix this. @abemedia do you know something about this? |
I have the same issue, also ctrl z does not undo text input like it does in the browser. |
@lucasfernog that PR only allows clipboard access from JS. You still need to write the JS event to capture it. |
Thanks for the leads. Don't know how I didn't find anything related to this when searching. For those wondering the solution is to listen for a copy or paste event and simply call Rudimentary vue example below. <template>
<Editor @keydown.meta.86="pasteEvent()" @keydown.meta.67="copyEvent()" ... />
</template>
<script>
// ...
copyEvent() {
document.execCommand('copy');
}
pasteEvent() {
document.execCommand('paste');
}
// ...
</script> |
@matthewmullin01 The cmd-c copy event works fine. The cmd-v paste event causes a content menu to appear with a paste option that you still have to click on to actually paste. Also there is a system beep that needs to be prevented by calling event.preventDefault(). This is on Mac. |
Just for reference, everything works as intended on Linux. |
This has been fixed in the dev branch of Tauri and will be available in the next release. |
I'm still seeing the contextmenu show up on Not sure if this version was the "next release" |
I'm also seeing the same behaviour... :( |
I have still the problem and also beeps. yes, it beeps. Even in textbox, cmd+a not possible. |
I'm running into the same issue. |
@FabianLars thank you! |
Managed to make it work with the A menu as you suggested but with some differences because the template used not sable API. let about_menu = Submenu::new("App", Menu::new()
.add_native_item(MenuItem::Hide)
.add_native_item(MenuItem::HideOthers)
.add_native_item(MenuItem::ShowAll)
.add_native_item(MenuItem::Separator)
.add_native_item(MenuItem::Quit));
let edit_menu = Submenu::new("Edit", Menu::new()
.add_native_item(MenuItem::Undo)
.add_native_item(MenuItem::Redo)
.add_native_item(MenuItem::Separator)
.add_native_item(MenuItem::Cut)
.add_native_item(MenuItem::Copy)
.add_native_item(MenuItem::Paste)
.add_native_item(MenuItem::SelectAll));
let view_menu = Submenu::new("View", Menu::new()
.add_native_item(MenuItem::EnterFullScreen));
let window_menu = Submenu::new("Window", Menu::new()
.add_native_item(MenuItem::Minimize)
.add_native_item(MenuItem::Zoom));
let help_menu = Submenu::new("Help", Menu::new()
.add_item(CustomMenuItem::new("Learn More", "Learn More")));
let menu = Menu::new()
.add_submenu(about_menu)
.add_submenu(edit_menu)
.add_submenu(view_menu)
.add_submenu(window_menu)
.add_submenu(help_menu);
app
.menu(menu)
.on_menu_event(|event| {
let event_name = event.menu_item_id();
match event_name {
"Learn More" => {
shell::open(
"https://www.my-app.com".to_string(),
None,
)
.unwrap();
}
_ => {}
}
}) Let it be known that there are some not specified menu items show up (probably the OS adds them???). Also, this should be added to the official documentation at some point :) |
I have noticed that using the keyboard shortcuts (
cmd/ctrl-c
andcmd/ctrl-v
) to copy or paste text from a input field does not work.I have however seen that using the right click context menu works as expected.
Note I am on MacOS 11.
To Reproduce
Communication
tabScreenshots
Platform and Versions (please complete the following information):
OS: Mac OS 11
Node: v12.18.3
NPM: 6.14.6
Yarn: 0.1.0
Rustc: 1.46.0 (04488afe3 2020-08-24)
The text was updated successfully, but these errors were encountered: