neutralinojs / webview

A modified version of C++ webview for Neutralinojs.
MIT License
10 stars 1 forks source link

Copy/Paste/Cut not working on macOS #9

Open volbil opened 4 years ago

volbil commented 4 years ago

Expected Behavior
When pressing cmd + c/v/x corresponding action is happening.

Actual Behavior
Nothing is happening.

Steps to Reproduce the Problem

  1. Run neutralino-mac executable
  2. Press cmd + c/v/x

Specifications

bung87 commented 4 years ago

I can confirm this.

Marcisbee commented 2 years ago

Any luck with this? I confirm this too.

benoneal commented 2 years ago

Can confirm this is still an issue on macOS with Neutralino v4.4.0.

javierrojas10 commented 1 year ago

Still an issue, there is a way at least to patch it?

AckerApple commented 1 year ago

Here is what I came up with that works really well so far, paste this code into your main.js file:

// monitor keyboard quick keys - (fixes Mac which currently is not respecting quick keys)
window.addEventListener('keydown', (event) => {
  const wasCommandUsed = event.metaKey === true // was command held
  if ( wasCommandUsed ) {
    switch(event.which) {
      case 81: // q
      case 87: // w
        return Neutralino.app.exit()
      case 86: // v
        return document.execCommand('paste')
      case 65: // a - select all
        return document.activeElement.select()
      case 67: // c
        return document.execCommand('copy')
      case 88: // x
        return document.execCommand('cut')
      case 82: // r - refresh
        return location.reload()
    }
  }
})