Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created December 14, 2015 11:26
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/4de5993601be65164935 to your computer and use it in GitHub Desktop.
Save bjoerntx/4de5993601be65164935 to your computer and use it in GitHub Desktop.
TXTextControl.addEventListener("ribbonTabsLoaded", function (e) {
restoreDocument();
var intervalAutoSave = setInterval(autoSaveDocument, 5000);
});
function autoSaveDocument() {
TXTextControl.saveDocument(TXTextControl.streamType.InternalUnicodeFormat, function (e) {
localStorage.document = e.data;
});
}
function restoreDocument() {
if (localStorage["document"]) {
TXTextControl.loadDocument(
TXTextControl.streamType.InternalUnicodeFormat,
localStorage.document);
$(".info").css("display", "inline-block");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment