Page 1 of 1

Catch "onchange" event of a document

Posted: Fri Mar 31, 2017 7:06 pm
by Isabelle

We use oxygen-, and we need to know when a document is changed (add/delete/update text or element, ...) in order to update our customize toolbar.
I try to override the method "editingOccured()" from the "InplaceEditingListener" interface but when I modify the document in the author page this method is not called.
How can I catch the "onchange" event of a document?


Re: Catch "onchange" event of a document

Posted: Mon Apr 03, 2017 10:16 am
by alex_jitianu
Hi Isabelle,

The InplaceEditingListener is used only when creating custom form controls. For your use case you should use a ro.sync.ecss.extensions.api.AuthorListener. In the context of an Author Component, such a listener is added like this:

Code: Select all

WSEditorPage currentPage = editorComponent.getWSEditorAccess().getCurrentPage();
if (currentPage instanceof WSAuthorEditorPage) {
AuthorDocumentController documentController = ((WSAuthorEditorPage) currentPage).getDocumentController();
documentController.addAuthorListener(new AuthorListenerAdapter() {
// TODO Override methods of interest.

Best regards,