Overview

Confluence 4.2 Breaking Changes for plugins providing custom editor JavaScript
==============================================================================

From Confluence 4.2 onwards, the full Confluenece editor may now be loaded in one of two circumstances:

1. When adding or editing a top-level content entity such as a page or blog post, or when editing a comment, a full page refresh will occur in order to load the editor.
2. When adding a new comment or replying to a comment, the editor will be loaded asynchronously using an AJAX call.

If your Confluence plugin supplies custom JavaScript to execute within the editor, you need to initialise your code in a way that works in both scenarios.

The old way of doing things was to wrap your JavaScript in a call to AJS.toInit() or jQuery.ready(). However, this will only work correctly in the first scenario.

The new way of doing things is to bind your JavaScript to the "init.rte" event.  For example:

AJS.bind("init.rte", function() {
    // Your editor JavaScript goes in here. The 'init.rte' event is fired after the editor has finished loading.
    alert("The Editor is now loaded!");
});

This alternative initialisation method will work in both scenarios, and is now the recommended way to load your JavaScript into the editor.