Client-side loading
Load HTML without rebuilding the page
Request HTML asynchronously, convert the response to the editor's document format, and load it into the current editor session.
Useful for browser workflowsLoad content after a user action, from an API response, or after a client-side template selection.
Ready to tryUse the controls above to interact with this demo.
What this demonstrates
Loading from JavaScript
JavaScript loading is the most flexible option when the document source is selected or transformed in the browser.
Key members
Convert and load content
TXTextControl.loadDocument
Save an editor document
TXTextControl.saveDocument
How it works
The demo fetches an HTML fragment, converts it to Base64, and calls TXTextControl.loadDocument with the appropriate stream type. The editor remains on the same page while its document is replaced.
For uploads or richer client-side editing, the same callback pattern can be combined with FileReader, a fetch response, or an application template picker.
fetch("/document.html")
.then(response => response.text())
.then(html => TXTextControl.loadDocument(
TXTextControl.StreamType.HTMLFormat,
html,
() => console.log("HTML loaded"),
undefined,
showError));
NuGet packages
TXTextControl.TextControl.Core.SDK
34.0.4
Provides the core document model and server-side document processing APIs.
dotnet add package TXTextControl.TextControl.Core.SDK --version 34.0.4
Provides the browser-based TX Text Control document editor and JavaScript API.
dotnet add package TXTextControl.Web --version 34.4.0
TXTextControl.Web.DocumentEditor.Backend
34.4.0
Hosts the WebSocket-based backend used by the browser document editor.
dotnet add package TXTextControl.Web.DocumentEditor.Backend --version 34.4.0
Source files
See the implementation
The view, browser behavior, and controller are encapsulated in Demos/RichTextEditor/DocumentManagement/FromJavaScript.