The release of Confluence 4.2 is not far away now, and it’s shaping up to be a doozy! We’ve just published a beta of Confluence 4.2, so be sure to download it and check out the release notes to see the upcoming features we’ll be shipping. More importantly, our betas and release candidates are a great opportunity to ensure your plugins will be ready to rock when the final version of Confluence 4.2 is shipped.

Quick Comments changes Editor Initialisation

One of the big improvements we’re shipping in Confluence 4.2 is ‘Quick Comments‘ – a major technical breakthrough for Confluence that allows us to dynamically load the editor on a Confluence page without causing a full page refresh. This means that users of Confluence 4.2 will be able to add comments and reply to comments with a slick, almost-instantaneous editor!

The implementation of Quick Comments required some pretty significant changes to the editor’s initialisation code. This will have consequences for some Confluence plugins. In particular, if you develop a Confluence plugin that meets any of the following criteria, you will need to make changes to your plugin in order to avoid your plugin not working in Confluence 4.2:

  • Your plugin has one or more Web Resource modules with a context of ‘editor’, ‘macrobrowser’ or ‘comment-editor’
  • Your plugin interacts with the ‘AJS.Editor’ JavaScript API
  • Your plugin declares custom behaviour for macros in the editor by, for example, calling any of the following methods:
    • AJS.MacroBrowser.setMacroJsOverride
    • AJS.Confluence.PropertyPanel.registerButtonHandler
    • tinymce.plugins.Autoconvert.autoConvert.addHandler


How to Maintain Compatibility

Prior to Confluence 4.2, the easiest (and recommended way) to load custom JavaScript into the editor was to register your code using the document’s ready event (eg. calling AJS.toInit or jQuery.ready).

[cc lang=’javascript’ ]

AJS.toInit(function() {

alert(“By this point, the editor is loaded!”);



This worked without a problem because the Confluence editor always caused a full page refresh in order to initialise – by the time the document ready event was fired, the editor was fully initialised and ready for plugins to interact with. Now, in Confluence 4.2, the Confluence editor can be loaded asynchronously on an existing page.

To accommodate this new behaviour, you should no longer load your JavaScript by handling the ready event. Instead, use the AJS.bind method to listen for the “init.rte” custom event. This event will be fired in both circumstances – when the quick comment editor is loaded asynchronously and when the editor is loaded to add or edit any other content.

[cc lang=’javascript’ ]

AJS.bind(“init.rte”, function() {

alert(“This is a better way to inject your js”);



I’ve created a a simple, example plugin in a bitbucket repository that demonstrates this suggested change.  Using the AJS.bind method is fully backwards compatible with Confluence 4.0.x and Confluence 4.1.x.

We Love Your Feedback

As always, any problems with the Confluence 4.2 beta release can be reported in Confluence’s Jira project.


JavaScript Changes Required for Confluence 4.2 Com...