Table of Contents

Class NuvTextDiff

Namespace
NuvTools.AspNetCore.Blazor.Components
Assembly
NuvTools.AspNetCore.Blazor.dll

Shows two versions of a text side by side, line by line: removed lines on the left, added on the right, changed lines paired with the differing part marked. Built for audit trails (formatted JSON before and after a change), but works for any text.

public class NuvTextDiff : ComponentBase, IComponent, IHandleEvent, IHandleAfterRender
Inheritance
NuvTextDiff
Implements
Inherited Members

Examples

<NuvTextDiff OldText="@before" NewText="@after" Style="max-height:420px;overflow:auto" />

Remarks

Needs the stylesheet _content/NuvTools.AspNetCore.Blazor/textdiff.css; its colours are CSS variables (--nuv-diff-added, --nuv-diff-removed, ...) the app can override. The comparison runs only when a text changes. For the rows themselves, use TextDiff.

Properties

AdditionalAttributes

Any other attribute is applied to the container.

[Parameter(CaptureUnmatchedValues = true)]
public IReadOnlyDictionary<string, object>? AdditionalAttributes { get; set; }

Property Value

IReadOnlyDictionary<string, object>

Class

CSS class applied to the container.

[Parameter]
public string? Class { get; set; }

Property Value

string

NewText

The new version. Empty when the item was deleted.

[Parameter]
public string? NewText { get; set; }

Property Value

string

OldText

The previous version. Empty when the item was just created.

[Parameter]
public string? OldText { get; set; }

Property Value

string

Style

Inline style applied to the container (a max-height with overflow, for instance).

[Parameter]
public string? Style { get; set; }

Property Value

string

Methods

BuildRenderTree(RenderTreeBuilder)

Renders the component to the supplied RenderTreeBuilder.

protected override void BuildRenderTree(RenderTreeBuilder __builder)

Parameters

__builder RenderTreeBuilder

OnParametersSet()

Method invoked when the component has received parameters from its parent in the render tree, and the incoming values have been assigned to properties.

protected override void OnParametersSet()