Support SVG icon in action menu#12403
Conversation
|
Hi there @bjarnef, thank you for this contribution! 👍 While we wait for one of the Core Collaborators team to have a look at your work, we wanted to let you know about that we have a checklist for some of the things we will consider during review:
Don't worry if you got something wrong. We like to think of a pull request as the start of a conversation, we're happy to provide guidance on improving your contribution. If you realize that you might want to make some changes then you can do that by adding new commits to the branch you created for this work and pushing new commits. They should then automatically show up as updates to this pull request. Thanks, from your friendly Umbraco GitHub bot 🤖 🙂 |
|
@nathanwoulfe could you have a look at this PR instead? |
|
@bergmania it would be great if we could include this in v10, white it by default still should use the old/legacy icon format (which assumed icons used a This PR #12062 may also be relevant, which does something similar. |
|
@nathanwoulfe hopefully this PR will do 😁 (after submitting it for v8, v9 and now v10 😅 ). I had a compile error though as mentioned here, but not related to this PR: |
| /// <param name="opensDialog">Whether or not this action opens a dialog</param> | ||
| public MenuItem? Add<T>(ILocalizedTextService textService, bool hasSeparator = false, bool opensDialog = false) | ||
| /// <param name="useLegacyIcon">Whether or not this action should use legacy icon prefixed with "icon-" or full icon name is specified.</param> | ||
| public MenuItem? Add<T>(ILocalizedTextService textService, bool hasSeparator = false, bool opensDialog = false, bool useLegacyIcon = true) |
There was a problem hiding this comment.
I'll highlight this one again @nathanwoulfe and @bjarnef - this is a common mistake: you can not add an optional parameter to a public method, this is always a breaking change as the signature of the method is changed.
Luckily the fix for this is easy and I fixed it here: 885ec99
So I took the whole method body and added it to a new method with the optional parameter on it. Then I call the new method from the old method (signature is unchanged), with the default value of useLegacyIcon: false.
There was a problem hiding this comment.
@nul800sebastiaan okay, I know it would be a breaking change if the order of the parameters changed or if the new options parameter was added before the existing ones, but didn't thought I would be a breaking change with the new parameter as optional and as last parameter.
Must have missed this method when I checked the custom code with various methods before and after this change.
There was a problem hiding this comment.
It's a common mistake! All good, fixed it up 👍
Prerequisites
Description
This is a new PR of closed #10757 to v9 and #12063 re-based to v10, but caused a few merge conflicts, so starting on a fresh branch.
At the moment it is assumed the icon (font icon or SVG icon) always is prefixed with icon- which is not always the case and not a requirement in other part of the UI).
It also fixes an issue with separator at menu item due a typo in view.