diff --git a/src/modules/Elsa.Studio.UIHints/Extensions/ServiceCollectionExtensions.cs b/src/modules/Elsa.Studio.UIHints/Extensions/ServiceCollectionExtensions.cs index 19907620..3e0fdb98 100644 --- a/src/modules/Elsa.Studio.UIHints/Extensions/ServiceCollectionExtensions.cs +++ b/src/modules/Elsa.Studio.UIHints/Extensions/ServiceCollectionExtensions.cs @@ -12,8 +12,6 @@ public static class ServiceCollectionExtensions /// /// Adds the default UI hint handlers. /// - /// - /// public static IServiceCollection AddDefaultUIHintHandlers(this IServiceCollection services) { return services @@ -24,6 +22,7 @@ public static IServiceCollection AddDefaultUIHintHandlers(this IServiceCollectio .AddUIHintHandler() .AddUIHintHandler() .AddUIHintHandler() + .AddUIHintHandler() .AddUIHintHandler() .AddUIHintHandler() .AddUIHintHandler() diff --git a/src/modules/Elsa.Studio.UIHints/Handlers/JsonEditorHandler.cs b/src/modules/Elsa.Studio.UIHints/Handlers/JsonEditorHandler.cs new file mode 100644 index 00000000..fa83029b --- /dev/null +++ b/src/modules/Elsa.Studio.UIHints/Handlers/JsonEditorHandler.cs @@ -0,0 +1,22 @@ +using Elsa.Studio.Contracts; +using Elsa.Studio.Models; +using Elsa.Studio.UIHints.Components; +using Microsoft.AspNetCore.Components; + +namespace Elsa.Studio.UIHints.Handlers; + +public class JsonEditorHandler : IUIHintHandler +{ + public bool GetSupportsUIHint(string uiHint) => uiHint == "json-editor"; + public string UISyntax => WellKnownSyntaxNames.Literal; + + public RenderFragment DisplayInputEditor(DisplayInputEditorContext context) + { + return builder => + { + builder.OpenComponent(0, typeof(Code)); + builder.AddAttribute(1, nameof(Code.EditorContext), context); + builder.CloseComponent(); + }; + } +} \ No newline at end of file