As I want to use two different Redactor plugins, table.js
and properties.js
, I decided to write a simple Craft Plugin to load the JS using includeJsResouce
in the init()
function, as so;
function init() {
if ( craft()->request->isCpRequest() && craft()->userSession->isLoggedIn() )
{
craft()->templates->includeJsResource('myextensions/js/properties.js');
craft()->templates->includeJsResource('myextensions/js/table.js');
}
}
However, I have found that these JS files are being loaded in the HTML before the Redactor.js file, so I get a JS error in the console, as Redactor is undefined. [Uncaught TypeError: Cannot read property 'prototype' of undefined
]
Is there a way to ensure that my plugin JS is loaded after Redactor that does not entail hacking the core of Craft?
The version of Craft I am using is the current, Craft Pro 2.5.2753.