-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add JsonEditorHandler to UI hint handlers
A new JsonEditorHandler class is added under the "Handlers" directory of Elsa.Studio.UIHints module. This handler class is designed to support "json-editor" UI hint in the application. It has been included in the default UI hint handlers registration in the "ServiceCollectionExtensions" class.
- Loading branch information
1 parent
23817c7
commit e1626cf
Showing
2 changed files
with
23 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/modules/Elsa.Studio.UIHints/Handlers/JsonEditorHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
}; | ||
} | ||
} |