Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created January 25, 2024 12:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/0158a72e11a433e0c3d9490dad3785be to your computer and use it in GitHub Desktop.
Save bjoerntx/0158a72e11a433e0c3d9490dad3785be to your computer and use it in GitHub Desktop.
@page "/"
@rendermode @(new InteractiveServerRenderMode(false))
@inject NavigationManager Navigator;
<PageTitle>Home</PageTitle>
<TextControl WebSocketURL=@Navigator.BaseUri
ContainerID="txDocumentEditorContainer"
@ref="_txtextcontrol">
</TextControl>
<button @onclick="InsertTable">Insert Table</button>
<button @onclick="SaveDocument">
Save and Reload Document (using ServerTextControl)
</button>
@code
{
private TextControl _txtextcontrol = default!;
// insert a table using the client-side API
private async Task InsertTable()
{
await _txtextcontrol.InsertTable();
}
// save the document and reload it using ServerTextControl
private async Task SaveDocument()
{
await _txtextcontrol.SaveDocument();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment