Custom javascript modules not loaded in Oxygen 25.1 responsive webhelp

Post here questions and problems related to editing and publishing DITA content.
rjcbop
Posts: 56
Joined: Wed Aug 08, 2018 10:23 pm

Custom javascript modules not loaded in Oxygen 25.1 responsive webhelp

Post by rjcbop »

We're upgrading from Oxygen 24.1 to 25.1 and noticed that our custom javascript modules are not getting loaded. For reference, we set the webhelp.enable.template.js.module.loading parameter to 'yes' in a publishing template and are generating responsive webhelp content. As a simple sanity check, we replaced the 25.1 version of the com.oxygenxml.webhelp.responsive plugin in the DITA-OT with the 24.1 version and that resolved the issue.

Thanks for any help with this issue.
beniamin_savu
Posts: 31
Joined: Fri Jan 22, 2021 11:05 am

Re: Custom javascript modules not loaded in Oxygen 25.1 responsive webhelp

Post by beniamin_savu »

Hi,

Starting with Oxygen WebHelp version 25 we made some major changes to the way the JavaScript files are bundled in the WebHelp Responsive output. We no longer use the RequireJS library. This is the library that was responsible for loading "JS AMD Modules".

Now you can add the custom JavaScript files to your WebHelp Responsive output without defining them as an AMD module and without setting the webhelp.enable.template.js.module.loading parameter. You can add them to your WebHelp Responsive output by using an HTML fragment which contains the JavaScript files. More details on how to add additional content can be found using the following link: https://www.oxygenxml.com/doc/versions/ ... -html.html

Best regards,
Beniamin Savu
Oxygen WebHelp Team
http://www.oxygenxml.com
rjcbop
Posts: 56
Joined: Wed Aug 08, 2018 10:23 pm

Re: Custom javascript modules not loaded in Oxygen 25.1 responsive webhelp

Post by rjcbop »

Thanks for that information! I didn't see anything about this pretty major change in the release notes for either 25 or 25.1. Was this announced somewhere?
ionela
Posts: 402
Joined: Mon Dec 05, 2011 6:08 pm

Re: Custom javascript modules not loaded in Oxygen 25.1 responsive webhelp

Post by ionela »

Hi,

Thank you for your feedback.

As this change is related with the way WebHelp internal resources are compiled unfortunately, it was not announced in the what's new section.
Please accept our apologize for all inconveniences this might have caused.

Regards,
Ionela
Ionela Istodor
oXygen XML Editor and Author Support
rjcbop
Posts: 56
Joined: Wed Aug 08, 2018 10:23 pm

Re: Custom javascript modules not loaded in Oxygen 25.1 responsive webhelp

Post by rjcbop »

Thanks for the replies. We have quite a bit of custom javascript code that we were loading with the AMD mechanism and are now trying to figure out the best way to move forward. Our code uses a lot of jQuery and we also have to manage some dependencies in terms of ensuring that various modules have been loaded before loading a particular module. Do you think that the approach described in How to Insert Custom HTML Content would work for our needs or would it be better to implement our own version of the AMD mechanism, i.e. by downloading RequireJS? Or is there another approach you would recommend? Thanks for any guidance you can provide.
beniamin_savu
Posts: 31
Joined: Fri Jan 22, 2021 11:05 am

Re: Custom javascript modules not loaded in Oxygen 25.1 responsive webhelp

Post by beniamin_savu »

Hi,

Unfortunately we cannot recommend any approach as we do not know how your custom JavaScript files interact and work within the WebHelp Responsive output. The How to Insert Custom HTML Content topic allows you to insert an HTML Fragment that contains your additional JavaScript files which will then be loaded in the WebHelp Responsive output. Your customization should make sure that the JavaScript files are loaded in the correct order.

The JQuery library that comes bundled with WebHelp is accessible in the browser's global context so that developers have access to use it. Please make sure that the @defer attribute is present on the <script> elements inside the HTML Fragment.

Best regards,
Beniamin Savu
Oxygen WebHelp Team
http://www.oxygenxml.com
rjcbop
Posts: 56
Joined: Wed Aug 08, 2018 10:23 pm

Re: Custom javascript modules not loaded in Oxygen 25.1 responsive webhelp

Post by rjcbop »

I just thought I'd send a quick follow-up that we were able to rewrite our code to load our javascript files with <script> elements (and setting the @defer attribute). However, we still had to add some timeout functions to wait for pieces of the Oxygen code to run before running some of our code that depends on those pieces of the Oxygen code. We'd be interested to know if there's an alternative to the approach we used.
Post Reply