TeamLab Document Editors API Documentation
config > events
- onReady - the function called when the document is loaded into the document editor;
- onDocumentStateChange - the function called when the document is modified;
- onRequestEditRights - the function called when the user is trying to switch the document from the viewing into the editing mode;
This parameter is obligatory when the editorConfig mode parameter is set to view and the permission to edit the document (document > permissions) is set to true so that the user to be able to switch to the editing mode.
- onBack - the function called when the Go to Documents link is clicked.
var docEditor = new DocsAPI.DocEditor('placeholder', { events: { 'onReady': onDocEditorReady, 'onDocumentStateChange': onDocumentStateChange, 'onRequestEditRights': onRequestEditRights, 'onSave': onDocumentSave, 'onError': onError, 'onBack': onBack } });
Two events have additional importance and should be viewed separately:
- onSave - the function called on document save. Returns the url of the saved document that can be used for further purposes.
var docEditor = new DocsAPI.DocEditor('placeholder', { events: { 'onSave': onDocumentSave } }); function onDocumentSave(event) { var url = event.data; }
- onError - the function called when an error or some other specific event occurs. Can help display error or message window styled in TeamLab document editor common internal style.
var docEditor = new DocsAPI.DocEditor('placeholder', { events: { 'onError': onError } }); function onError(event) { var docEditorShowError = function (message, title) { ASC.Files.Editor.docEditor.showError(title || "The Error Title", "The error text which is to be displayed in the error window."); }; var docEditorShowMessage = function (message, title) { ASC.Files.Editor.docEditor.showMessage(title || "The Message Title", "The message text which is to be displayed in the message window."); }; }
Please see other sections for more options: