mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
[CmdPal] Fix context menu command items (#45499)
maintainers: we talked about this at length on Teams > Seems like adding `IExtendedAttributesProvider` onto `CommandItem` is what broke this. I don't know why. I'm not gonna pretend to understand the cswinrt voodoo that's causing it to pick `IEAP` as the leaf interface instead of `ICommandContextItem`. drive by: fix the sample project on ARM _resurrected from #45329 because spellbot killed that PR_
This commit is contained in:
@@ -8,8 +8,14 @@ using WinRT;
|
||||
|
||||
namespace Microsoft.CommandPalette.Extensions.Toolkit;
|
||||
|
||||
public partial class CommandItem : BaseObservable, ICommandItem, IExtendedAttributesProvider
|
||||
public partial class CommandItem : BaseObservable, ICommandItem
|
||||
{
|
||||
// NOTE TO MAINTAINERS: Do NOT implement `IExtendedAttributesProvider` here
|
||||
// directly. Instead, implement it in derived classes like `ListItem` where
|
||||
// appropriate.
|
||||
//
|
||||
// Putting it directly here will cause out-of-proc extensions to fail to
|
||||
// load the context menu commands, for unknown CsWinRT reasons.
|
||||
private readonly PropertySet _extendedAttributes = new();
|
||||
|
||||
private ICommand? _command;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
namespace Microsoft.CommandPalette.Extensions.Toolkit;
|
||||
|
||||
public partial class FallbackCommandItem : CommandItem, IFallbackCommandItem, IFallbackHandler, IFallbackCommandItem2
|
||||
public partial class FallbackCommandItem : CommandItem, IFallbackCommandItem, IFallbackHandler, IFallbackCommandItem2, IExtendedAttributesProvider
|
||||
{
|
||||
private readonly IFallbackHandler? _fallbackHandler;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
namespace Microsoft.CommandPalette.Extensions.Toolkit;
|
||||
|
||||
public partial class ListItem : CommandItem, IListItem
|
||||
public partial class ListItem : CommandItem, IListItem, IExtendedAttributesProvider
|
||||
{
|
||||
public virtual ITag[] Tags { get; set => SetProperty(ref field, value); } = [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user