Comments (7)
Makes sense, but should be based on id
, not the label. I don't think we need an option for it. Should the replaced item take the original position or be added to the start/end depending on whether prepend/append was used? I'm leaning towards the latter.
We currently have a shouldShowMenu
option, so it could also maybe be useful with one for menu items called shouldShowMenuItem
? In case you want to dynamically decide which of the items to show.
from electron-context-menu.
but one would want to localize this library too
It would be weird to have to translate the menu item here when you don't use it and instead override it with your. These are many reasons why as stable ID is better.
from electron-context-menu.
Makes sense, but should be based on id, not the label.
Maybe if no id is explicitly provided but the label is the same as a default menu item that default menu item should still be omitted? I just can't imagine a scenario where one would want 2 "Copy" menu items like shown in the screenshot.
Should the replaced item take the original position or be added to the start/end depending on whether prepend/append was used?
I'd say the latter too.
We currently have a shouldShowMenu option, so it could also maybe be useful with one for menu items called shouldShowMenuItem? In case you want to dynamically decide which of the items to show.
Maybe, I'm currently updating the menus inside shouldShowMenu
before showing them (ref).
If there was a shouldShowMenuItem
item option I think that could be useful in some scenarios, but I would personally not use it as whether or not some menu items should be shown may depend on some computation that I'd rather perform once for all items rather than for each time and I'd rather perform it next to the logic for updating the menu itself rather than in a different place.
Maybe an updateMenu
option, maybe called with the entire menu template before showing it, could be useful too.
I'd be happy to submit a PR implementing these features π
from electron-context-menu.
Maybe if no id is explicitly provided but the label is the same as a default menu item that default menu item should still be omitted? I just can't imagine a scenario where one would want 2 "Copy" menu items like shown in the screenshot.
The reason I want to base it on id
is that menu items could be localized and that could create ambiguity. It's just easier to reason about if it's only based on the id
.
Maybe an updateMenu option, maybe called with the entire menu template before showing it, could be useful too.
π That actually sounds more useful and flexible than my shouldShowMenuItem
idea.
from electron-context-menu.
The reason I want to base it on id is that menu items could be localized and that could create ambiguity. It's just easier to reason about if it's only based on the id.
I see your point, but some apps don't deal with i18n at all, and those who do I guess would translate "Copy" from this library and the custom "Copy" item with the same string π€
I'll try to get the PR done by the end of the week π
from electron-context-menu.
I see your point, but some apps don't deal with i18n at all, and those who do I guess would translate "Copy" from this library and the custom "Copy" item with the same string π€
I was referring to depending on overriding the "Copy" item here, then localizing and suddenly the override stops working as the labels no longer match.
from electron-context-menu.
Yeah yeah, but one would want to localize this library too and assuming both instances of "Copy" get localized to the same string (but languages are complicated, maybe this assumption can't be made) the override would still work.
from electron-context-menu.
Related Issues (20)
- using the spell checker to replace a misspelled word crashes electronjs. HOT 2
- properties not defined HOT 1
- Not Working on Production HOT 10
- Unclear documentation: please add sample code for enabling hidden built-in options HOT 2
- Not working in Electron 14.0.0 HOT 1
- Electron 15: Module '"electron"' has no exported member 'WebviewTag' HOT 3
- Interaction with menubar HOT 1
- Enable accelerators for edit options HOT 1
- Ability to hide "Copy Link" and "Save Link As" for `file://` protocol HOT 2
- Incorrect Typescript types for defaultActions
- Default action `saveLinkAs` does not exist in Typescript type definitions
- Add other search engines HOT 4
- Picture in picture HOT 1
- [HELP] get link when right click HOT 2
- Allows to translate "No Guesses Found" when no suggestion are available
- The default options like 'cut' 'copy' 'paste', etc. don't show accelerators next to them HOT 5
- How to add all βPasteβ and βPaste as plain textβ ?
- Can I paste an image? HOT 1
- Shortcuts not working HOT 1
- Not working with Electron version >=27
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from electron-context-menu.