Created
October 5, 2023 13:30
-
-
Save bjoerntx/d5905631c049a2a915004fe728ae3607 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dotNetObject; | |
export async function addEditorToElement(dotNetRef, options) { | |
dotNetObject = dotNetRef; | |
TXTextControl.init({ | |
containerID: "txDocumentEditorContainer", | |
webSocketURL: options.websocketurl | |
}); | |
} | |
export function saveDocument() { | |
// save the document on TXTextControl object | |
TXTextControl.saveDocument(TXTextControl.StreamType.InternalUnicodeFormat, function (document) { | |
// call the .NET method 'ProcessDocument' with the saved document data | |
dotNetObject.invokeMethodAsync('ProcessDocument', document.data); | |
}); | |
}; | |
export function loadDocument(document) { | |
// load the document back into the editor (TXTextControl) | |
TXTextControl.loadDocument(TXTextControl.StreamType.InternalUnicodeFormat, document); | |
}; | |
export function insertTable() { | |
TXTextControl.tables.add(5, 5, 10, function (e) { | |
if (e === true) { // if added | |
TXTextControl.tables.getItem(function (table) { | |
table.cells.forEach(function (cell) { | |
cell.setText("Cell text"); | |
}); | |
}, null, 10); | |
} | |
}) | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment