Catching Editing Events

Catching Editing Events

The “load” event

scrivito.on('load', callback: Function) --> undefined

The load event invokes the callback function after the in-place editing UI has been completely loaded and is fully available. This can be used for adding custom functionality such as individual editors for CMS object attributes to pages. For detecting whether a page is potentially modifyable, use scrivito.in_editable_view():

If you wish to provide custom editing functionality, take a look at the Scrivito Editors.

The “content” event

scrivito.on('content', callback: Function(DOMElement)) --> undefined

The content event invokes the callback function when new content has been added to the page. This can be used for notification purposes, for example. Your callback will receive the root DOM node of the new content. The callback will be invoked in all in-place editing modes, i.e. also when viewing changes, not just when editing content.

If in-place editing is not active, the callback is triggered when the DOM is ready.