Skip to content
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

Not Working on Production #144

Open
EhsanFox opened this issue Sep 5, 2021 · 10 comments
Open

Not Working on Production #144

EhsanFox opened this issue Sep 5, 2021 · 10 comments

Comments

@EhsanFox
Copy link

EhsanFox commented Sep 5, 2021

hey, I build my app with electron-builder and the context menu is not working in the production, but it works fine in developments.

@EhsanFox
Copy link
Author

EhsanFox commented Sep 5, 2021

when i click, it won't open anything.......

@ghost
Copy link

ghost commented Sep 5, 2021

We can't help if you don't provide more info :/

And also, you shouldn't ask for help here. I come from the electron.js discord server, there we can help you! This is only to track bugs and other stuff.

@EhsanFox
Copy link
Author

EhsanFox commented Sep 6, 2021

well, this kinda looks like a bug, it works before building/packaging the app, but not afterward.

@EhsanFox
Copy link
Author

EhsanFox commented Sep 6, 2021

for more information, I just did what it said on example, it works fine in the dev process

@ghost
Copy link

ghost commented Sep 6, 2021

for more information, I just did what it said on example, it works fine in the dev process

We don't know which app isn't working or how we should repro this issue :/. Maybe create a repro gist or link your repo?

@EhsanFox
Copy link
Author

EhsanFox commented Sep 6, 2021

well, the app is private, but the context menu (literally the example code) in the readme is not working on the production......
i opened a help channel in Electron discord server too (channel number 9)

@EhsanFox
Copy link
Author

EhsanFox commented Sep 6, 2021

here is the code:

const ctxMenu = require("electron-context-menu");
ctxMenu({
        window: mainTab,
        labels: {
            copy: "📄 | Copy",
            paste: "📋 | Paste",
            cut: "✂ | Cut"
        },

        /* Context Menu Items */
        menu: (actions, params, win, dicSuggestion) => [
            /* Custom Buttons */
            {
                label: 'WinTube v'+version,
                icon: path.resolve(__dirname, "..", "..", "src", "icons", "main-min.png"),
                enabled: false,
            },
            {
                label: 'Discord Server',
                icon: path.resolve(__dirname, "..", "..", "src", "icons", "discord.png"),
                click: () => open('https://discord.gg/GBDkr9T')
            },
            actions.separator(),
            /* System Buttons */
            actions.copy(),
            actions.cut(),
            actions.paste(),
            actions.separator(),
            /* Public Buttons */
            {
                label: "Exit",
                icon: path.resolve(__dirname, "..", "..", "src", "icons", "shutdown.png"),
                click: () => app.quit()
            },
            
            /* Dev Buttons */
            {
                label: 'Developer Tools',
                icon: path.resolve(__dirname, "..", "..", "src", "icons", "dev-tools.png"),
                click: () => mainTab.webContents.openDevTools(),
                visible: isDev
            },
        ]
    });
    
    it's on 'ready' event btw.

@ghost
Copy link

ghost commented Sep 6, 2021

Where is this code? Main thread? Renderer thread?

@EhsanFox
Copy link
Author

app ready event is obviously on the main thread

@nop33
Copy link

nop33 commented Mar 3, 2022

Are you sure you didn't install it as a dev dependency?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants