The Artima Developer Community
Sponsored Link

Java Buzz Forum
JavaScript Changes Required for Confluence 4.2 Compatibility

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Mathias Bogaert

Posts: 618
Nickname: pathos
Registered: Aug, 2003

Mathias Bogaert is a senior software architect at Intrasoft mainly doing projects for the EC.
JavaScript Changes Required for Confluence 4.2 Compatibility Posted: Mar 15, 2012 1:19 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Mathias Bogaert.
Original Post: JavaScript Changes Required for Confluence 4.2 Compatibility
Feed Title: Scuttlebutt
Feed URL: http://feeds.feedburner.com/AtlassianDeveloperBlog
Feed Description: tech gossip by mathias
Latest Java Buzz Posts
Latest Java Buzz Posts by Mathias Bogaert
Latest Posts From Scuttlebutt

Advertisement
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). 12345AJS.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. 12345AJS.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.  

Read: JavaScript Changes Required for Confluence 4.2 Compatibility

Topic: A SMALL cross-section of BIG Data Previous Topic   Next Topic Topic: Why should you use Unchecked exceptions over Checked exceptions in Java

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use