Skip to content
This repository has been archived by the owner on Jan 27, 2023. It is now read-only.

[bug] IContributedMenuItem.icon: cannot use image url #68

Open
konradsikorski opened this issue Jan 5, 2018 · 2 comments
Open

[bug] IContributedMenuItem.icon: cannot use image url #68

konradsikorski opened this issue Jan 5, 2018 · 2 comments
Labels

Comments

@konradsikorski
Copy link

When childItems of IContributedMenuItem is type of IPromise<IContributedMenuItem[]> then the icon is ALWAYS treated as css class not as image url (so you cannot have icon as an image).

In this example I have menu item where icon is set to url and has child with exactly the same icon. The result will be as following:

  • "change state" menu item will have icon
  • "test child" will have empty icon because the generated html has set class to following <span class="icon menu-item-icon static/images/changeStatusAction.png" aria-hidden="true"></span>

To fix it I have to comment the Q line but I cannot do this in my project I need the IPromise.

menuHandler = (context: any) : IContributedMenuSource => {
return <IContributedMenuSource> {
	getMenuItems: (actionContext: any)  => {
		let subMenus = 
			// comment the Q and the icon will work
			Q(
				Array<IContributedMenuItem>( 
				{
					text: "test child",
					icon: "static/images/changeStatusAction.png",
				});
			);
		
		return new Array<IContributedMenuItem>(
			{
				text: "Change state",
				groupId: "modify",
				icon: "static/images/changeStatusAction.png",
				childItems: subMenus,
			}
		);
	}
};
}
VSS.register(VSS.getContribution().id, menuHandler);
@cschleiden cschleiden added the bug label Jan 6, 2018
@MrTarantula
Copy link

I am having the opposite problem in #44. I want a class and not an image. I never would have thought to wrap it in a promise. That's some very confusing behavior, and as far as I can see, not documented anywhere.

@konradsikorski
Copy link
Author

Do you have plan to fix this? Because of this I am blocked and cannot release new version of my extension :(

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

No branches or pull requests

3 participants