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

Pass dictionary suggestions to the menu option function #111

Merged
merged 3 commits into from
Jul 12, 2020
Merged

Pass dictionary suggestions to the menu option function #111

merged 3 commits into from
Jul 12, 2020

Conversation

smithalan92
Copy link
Contributor

At the moment, if you need to use the menu function to build a custom menu for whatever reason, you need to duplicate all the work the module does to correctly put spellcheck suggestions into the menu.

This tweak passes the dictionarySuggestions Array generated by the module as a 4th param to the menu function, so it can be used as is to provide spellcheck in the custom menu template.

@sindresorhus
Copy link
Owner

You need to update index.d.ts too.

@sindresorhus
Copy link
Owner

I'm also curious why you're using the menu option? It should really just be a last option. Maybe there's something that can be done to enable your use-case.

@smithalan92
Copy link
Contributor Author

Hey @sindresorhus , thanks for taking a look. I've pushed those changes as requested.

I'm also curious why you're using the menu option? It should really just be a last option. Maybe there's something that can be done to enable your use-case.

The reason we need to use the menu option is more to do with how our app is structured, rather than defaults of the module. Basically, Electron loads a web app in a webview, but we load specific version urls to make sure the desktop/web app builds always match. So a desktop version of 1.0.0 would load a url like /app-version/1.0.0 , however we don't want to expose these version urls to a user, so when links are opened externally, or copied etc.. , we need to rewrite those urls from
/app-version/1.0.0 to /app to keep it nice and simple for an end user, using the menu option allows us to do to this.

@sindresorhus
Copy link
Owner

The reason we need to use the menu option is more to do with how our app is structured, rather than defaults of the module. Basically, Electron loads a web app in a webview, but we load specific version urls to make sure the desktop/web app builds always match. So a desktop version of 1.0.0 would load a url like /app-version/1.0.0 , however we don't want to expose these version urls to a user, so when links are opened externally, or copied etc.. , we need to rewrite those urls from
/app-version/1.0.0 to /app to keep it nice and simple for an end user, using the menu option allows us to do to this.

So you use menu because you need the transform option for some of the items? Maybe we could add a global transform option or something.

@sindresorhus sindresorhus changed the title Pass dictionary suggestions to the menu function Pass dictionary suggestions to the menu option function Jul 12, 2020
@sindresorhus sindresorhus merged commit c2d5551 into sindresorhus:master Jul 12, 2020
@smithalan92 smithalan92 deleted the passDictSuggestionsToMenuFn branch July 12, 2020 22:35
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

Successfully merging this pull request may close these issues.

None yet

2 participants