Skip to content

Commit c120e55

Browse files
add example of setting text dynamically to sample project
1 parent b26b455 commit c120e55

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

samples/BlazorServer/Pages/EditorView.razor

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<MudStack Justify="Justify.FlexEnd" Row="true">
2+
<MudButton OnClick="AddParagraph" Size="Size.Small">Add Paragraph</MudButton>
23
<MudButton OnClick="OnCancel" Size="Size.Small">Cancel</MudButton>
34
<MudButton OnClick="Reset" Size="Size.Small">Reset</MudButton>
45
<MudButton Color="Color.Primary" OnClick="SaveChanges" Size="Size.Small" StartIcon="@Icons.Material.Filled.Save" Variant="Variant.Filled">Save Changes</MudButton>
@@ -33,4 +34,9 @@
3334
{
3435
await OnSave.InvokeAsync(_html);
3536
}
37+
38+
private async Task AddParagraph()
39+
{
40+
await _editor.SetHtml(_editor.Html + Environment.NewLine + "<p>New Paragraph</p>");
41+
}
3642
}

samples/BlazorWasm/Pages/EditorView.razor

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<MudStack Justify="Justify.FlexEnd" Row="true">
2+
<MudButton OnClick="AddParagraph" Size="Size.Small">Add Paragraph</MudButton>
23
<MudButton OnClick="OnCancel" Size="Size.Small">Cancel</MudButton>
34
<MudButton OnClick="Reset" Size="Size.Small">Reset</MudButton>
45
<MudButton Color="Color.Primary" OnClick="SaveChanges" Size="Size.Small" StartIcon="@Icons.Material.Filled.Save" Variant="Variant.Filled">Save Changes</MudButton>
@@ -33,4 +34,9 @@
3334
{
3435
await OnSave.InvokeAsync(_html);
3536
}
37+
38+
private async Task AddParagraph()
39+
{
40+
await _editor.SetHtml(_editor.Html + Environment.NewLine + "<p>New Paragraph</p>");
41+
}
3642
}

0 commit comments

Comments
 (0)