public interface IMokaJsonViewer
Namespace: Moka.Blazor.Json.Abstractions
Properties
| Name | Description |
|---|---|
IsEditing abstract |
Gets whether the viewer is currently in edit mode. |
SelectedPath abstract |
Gets the currently selected node's JSON Pointer path, or null if nothing is selected. |
IsEditing
bool IMokaJsonViewer.IsEditing { get; }
Gets whether the viewer is currently in edit mode.
SelectedPath
string? IMokaJsonViewer.SelectedPath { get; }
Gets the currently selected node's JSON Pointer path, or null if nothing is selected.
Methods
| Name | Description |
|---|---|
ClearSearch() abstract |
Clears the current search results and highlighting. |
CollapseAll() abstract |
Collapses all nodes in the tree. |
ExpandAll() abstract |
Expands all nodes in the tree. |
ExpandToDepth(int depth) abstract |
Expands all nodes up to the specified depth. Pass -1 for unlimited. |
GetJson(bool indented) abstract |
Gets the current JSON content as a formatted string. |
NavigateToAsync(string jsonPointer, CancellationToken cancellationToken) abstract |
Navigates to and selects the node at the specified JSON Pointer path (RFC 6901). |
NextMatch() abstract |
Navigates to the next search match. |
PreviousMatch() abstract |
Navigates to the previous search match. |
Redo() abstract |
Redoes the last undone edit operation. Only available when editing is enabled. |
SearchAsync(…) abstract |
Initiates a search with the given query. |
Undo() abstract |
Undoes the last edit operation. Only available when editing is enabled. |
ClearSearch()
void IMokaJsonViewer.ClearSearch()
Clears the current search results and highlighting.
CollapseAll()
void IMokaJsonViewer.CollapseAll()
Collapses all nodes in the tree.
ExpandAll()
void IMokaJsonViewer.ExpandAll()
Expands all nodes in the tree.
ExpandToDepth(int depth)
void IMokaJsonViewer.ExpandToDepth(int depth)
Expands all nodes up to the specified depth. Pass -1 for unlimited.
Parameters
| Name | Type | Description |
|---|---|---|
depth | int | Maximum depth to expand, or -1 for all. |
GetJson(bool indented)
string IMokaJsonViewer.GetJson(bool indented = true)
Gets the current JSON content as a formatted string.
Parameters
| Name | Type | Description |
|---|---|---|
indented | bool | Whether to pretty-print the output. |
Returns: The JSON string.
NavigateToAsync(string jsonPointer, CancellationToken cancellationToken)
ValueTask IMokaJsonViewer.NavigateToAsync(string jsonPointer, CancellationToken cancellationToken = null)
Navigates to and selects the node at the specified JSON Pointer path (RFC 6901).
Parameters
| Name | Type | Description |
|---|---|---|
jsonPointer | string | The JSON Pointer path, e.g. "/users/0/name". |
cancellationToken | CancellationToken | Cancellation token. |
NextMatch()
void IMokaJsonViewer.NextMatch()
Navigates to the next search match.
PreviousMatch()
void IMokaJsonViewer.PreviousMatch()
Navigates to the previous search match.
Redo()
void IMokaJsonViewer.Redo()
Redoes the last undone edit operation. Only available when editing is enabled.
SearchAsync(string query, JsonSearchOptions? options, CancellationToken cancellationToken)
ValueTask<int> IMokaJsonViewer.SearchAsync(string query, JsonSearchOptions? options = null, CancellationToken cancellationToken = null)
Initiates a search with the given query.
Parameters
| Name | Type | Description |
|---|---|---|
query | string | The search query string. |
options | Moka.Blazor.Json.Abstractions.JsonSearchOptions? | Search options (regex, case sensitivity, etc.). |
cancellationToken | CancellationToken | Cancellation token. |
Returns: The number of matches found.
Undo()
void IMokaJsonViewer.Undo()
Undoes the last edit operation. Only available when editing is enabled.
Type Relationships
classDiagram
style IMokaJsonViewer fill:#f9f,stroke:#333,stroke-width:2px
MokaJsonViewer ..|> IMokaJsonViewer : implements
View Source
/// <summary>
/// Programmatic interface for controlling the JSON viewer component.
/// </summary>
public interface IMokaJsonViewer
{
/// <summary>
/// Gets the currently selected node's JSON Pointer path, or null if nothing is selected.
/// </summary>
string? SelectedPath { get; }
/// <summary>
/// Gets whether the viewer is currently in edit mode.
/// </summary>
bool IsEditing { get; }
/// <summary>
/// Navigates to and selects the node at the specified JSON Pointer path (RFC 6901).
/// </summary>
/// <param name = "jsonPointer">The JSON Pointer path, e.g. "/users/0/name".</param>
/// <param name = "cancellationToken">Cancellation token.</param>
ValueTask NavigateToAsync(string jsonPointer, CancellationToken cancellationToken = default);
/// <summary>
/// Expands all nodes up to the specified depth. Pass <c>-1</c> for unlimited.
/// </summary>
/// <param name = "depth">Maximum depth to expand, or -1 for all.</param>
void ExpandToDepth(int depth);
/// <summary>
/// Collapses all nodes in the tree.
/// </summary>
void CollapseAll();
/// <summary>
/// Expands all nodes in the tree.
/// </summary>
void ExpandAll();
/// <summary>
/// Initiates a search with the given query.
/// </summary>
/// <param name = "query">The search query string.</param>
/// <param name = "options">Search options (regex, case sensitivity, etc.).</param>
/// <param name = "cancellationToken">Cancellation token.</param>
/// <returns>The number of matches found.</returns>
ValueTask<int> SearchAsync(string query, JsonSearchOptions? options = null, CancellationToken cancellationToken = default);
/// <summary>
/// Navigates to the next search match.
/// </summary>
void NextMatch();
/// <summary>
/// Navigates to the previous search match.
/// </summary>
void PreviousMatch();
/// <summary>
/// Clears the current search results and highlighting.
/// </summary>
void ClearSearch();
/// <summary>
/// Undoes the last edit operation. Only available when editing is enabled.
/// </summary>
void Undo();
/// <summary>
/// Redoes the last undone edit operation. Only available when editing is enabled.
/// </summary>
void Redo();
/// <summary>
/// Gets the current JSON content as a formatted string.
/// </summary>
/// <param name = "indented">Whether to pretty-print the output.</param>
/// <returns>The JSON string.</returns>
string GetJson(bool indented = true);
}