Angular Only: txDocumentEditorLoaded
When using Angular, the object TXTextControl is dynamically created and therefore accessible at a later time. For this purpose, a global event on the document element is available. After this event is triggered, the TXTextControl object is available.
The following code shows how to attach an event to TXTextControl within the txDocumentEditorLoaded event handler:
Diagram: Initialization Events
The following diagram shows the chain of events that are fired on creating a new instance of the document editor.
The events textControlLoaded, documentLoaded and ribbonTabsLoaded are asynchronous and the order might vary depending on the loading time and file size for loaded documents.
Manipulating the Content
The content of the document can be manipulated after the textControlLoaded event is fired. The following code will not work as the Text Control is not ready to accept changes on the document:
In order to manipulate the content on creating a new instance of the editor, the code must be inside (or after) the textControlLoaded event:
Manipulating a Document
In case a document is loaded on creating an instance of the document editor, the content can be manipulated after the documentLoaded event is triggered:
Changing the Ribbon
The last event in this chain is the ribbonTabsLoaded event that is triggered after the complete ribbon DOM is available for manipulation. The following code shows how to remove the Clipboard ribbon group of the Home ribbon tab: