Giter VIP home page Giter VIP logo

Comments (11)

tommoor avatar tommoor commented on September 27, 2024

I came here to report both of these issues (#3 #4), unfortunately between them they kind of make this module unusable 😢

from electron-input-menu.

parro-it avatar parro-it commented on September 27, 2024

Hi @tommoor I didn't provide many details in both issues...
Let's me explain them and provide some more insight.

They are both related to electron-localshortcut module, but I posted them here because is where I've discovered

This one, the #4, happens because electron-localshortcut is remote.required and so it register the handlers on main process. When you refresh the page, the keyboard shortcuts are still considered registered by electron-localshortcuts, so it doesn't register the new ones, and cannot execute the old ones because old renderer process is gone.

I thought of solving this by providing a method that register the shortcuts and that has to be called directly from the main process. What do you think of this solution?

Regarding #3, this is caused by the fact that shortcuts get unregistered by electron-localshortcut when a BrowserWindow lose focus, and re-registered when one got focus again. Unfortunatly, this events does not fire when Devtools is in docked mode, so the shortcuts conflict with DevTools ctrl-c ctrl-v stuff.

I think this could be patched by detecting when dev-tools is opened/closed and disabling the shortcuts, I'm unsure if fix them on this repo or on electron-localshortcut?

Any help or suggestion is greatly appreciated! Thanks

from electron-input-menu.

tommoor avatar tommoor commented on September 27, 2024

Hey, thanks for the context. You already have a context.activate, how about a deactivate that would unregister the localshortcuts and the module user would have to place this in the beforeunload or similar...

It seems like quite a heavyweight way to implement the shortcuts globally and then enable and disable them, are you just doing this instead of a document event to get the same accelerator formatting that electron uses internally?

from electron-input-menu.

parro-it avatar parro-it commented on September 27, 2024

It seems like quite a heavyweight way to implement the shortcuts globally and then enable and disable them, are you just doing this instead of a document event to get the same accelerator formatting that electron uses internally?

Exactly! I start the module as a workaround for this Electron issue. It solve the immediate problem, but as you see it also as some drawback...

Regarding this repo, I think we could simply remove electron-localshortcut dep and reimplement the shortcuts as simple DOM events listener. It should solve both issues and should be easy to implement.

from electron-input-menu.

parro-it avatar parro-it commented on September 27, 2024

@tommoor I reimplemented shortcuts as I described in previous message. Could you please try version 2.0.0 and see if this solved the problems also on your side?

I published a major release because now you have to activate shortcuts calling new registerShortcuts method as described in README. It is otherwise possible that, if you keep default Electron app "Edit" menu, you get the various actions called twice...

from electron-input-menu.

tommoor avatar tommoor commented on September 27, 2024

I'll check this out! This struck me earlier on actually, I don't think this plugin should ever register shortcuts personally after thinking about it... I only expected it to add the context menu as described.

from electron-input-menu.

parro-it avatar parro-it commented on September 27, 2024

Oh, I'm sorry, I just give the presence of the standard shortcuts for input menu implicitly assumed, I should have specified it in readme before!
ANyway, thank you for your efforts 😄

from electron-input-menu.

tommoor avatar tommoor commented on September 27, 2024

I just tried this, I don't believe it's published to NPM correctly - the 2.0.0 version contains a package, license and readme but no js files

from electron-input-menu.

parro-it avatar parro-it commented on September 27, 2024

I should have been affected by this NPM issue. It's really annoying.
Could you please retry version 2.01 I just published using Node 4?

from electron-input-menu.

keverw avatar keverw commented on September 27, 2024

I just found this module and it looks like this issue is fixed from my testing.

from electron-input-menu.

parro-it avatar parro-it commented on September 27, 2024

Thank you @keverw, closing this

from electron-input-menu.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.