Bitbucket is a code hosting site with unlimited public and private repositories. We're also free for small teams!

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.

Recent activity

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.