Details
-
Bug
-
Resolution: Solved By
-
Major
-
None
-
9.8
-
None
-
Unknown
-
Description
On the AnnotationCode.Script jsx, the way the annotations initialization code is written can cause in some case the initialization code to not be executed. Therefore, the annotations shortcuts and the 'Annotations' link on the 'More' menu will not work.
Currently the code of the annotations intialization is something like :
document.observe('xwiki:dom:loaded', function() { // Annotations initialization handler });
The issue might appear when the AnnotationCode.Script script is loaded after the 'xwiki:dom:loaded' event is triggered, in this case the Annotations script will never observe the event and therefore never execute the initialization handler.
To prevent the annotations initialization handler to never being called, the initialization hanlder need to be called properly as explained on the xwiki.org documentation : https://www.xwiki.org/xwiki/bin/view/Documentation/DevGuide/FrontendResources/JavaScriptAPI/#HDOMEvents28xwiki.js29.
The annotations initialization handler code should be called this way:
function init() { // This is your initialization handler, that you generally hook to xwiki:dom:loaded } (XWiki && XWiki.domIsLoaded && init()) || document.observe("xwiki:dom:loaded", init);
Attachments
Issue Links
- is related to
-
XWIKI-11169 Annotations can not be displayed on content generated by the HTML macro
- Closed