JavaScript Page Editor function hooks are available to modify CMS behavior for advanced integrations.
They can be used as follows:
<script>
if(window.jsHarmonyCMSInstance) jsHarmonyCMSInstance.onInit = function(jsh){
alert('CMS Initialized');
};
</script>
Fired after the core jsHarmony script is loaded, but before jsHarmony CMS scripts are loaded
if(window.jsHarmonyCMSInstance) jsHarmonyCMSInstance.onInit = function(jsh){
/* Code Here */
};
Fired after the core jsHarmony CMS is loaded, but before the Page Editor is loaded
if(window.jsHarmonyCMSInstance) jsHarmonyCMSInstance.onLoad = function(jsh){
/* Code Here */
};
Fired when the jsHarmony CMS Page Editor is fully loaded
if(window.jsHarmonyCMSInstance) jsHarmonyCMSInstance.onLoaded = function(jsh){
/* Code Here */
};
Fired each time the Page Editor renders the page content (on load and after each save)
if(window.jsHarmonyCMSInstance) jsHarmonyCMSInstance.onRender = function(page){
/* Code Here */
};
Fired on initialization. Can be used to return the URL of a custom CMS Page Controller.
View the source code of jsharmony-cms/clientjs/jsHarmonyCMS.Controller.js for a more detailed example.
if(window.jsHarmonyCMSInstance) jsHarmonyCMSInstance.onGetControllerUrl = function(){
return 'https://domain/path/to/controller.js';
};
Override the standard file picker querystring parameters
if(window.jsHarmonyCMSInstance) jsHarmonyCMSInstance.onFilePickerCallback = function(filePickerType, url){
if(overrideFilePicker){
return { init_page_path: 'path/to/page'; }
}
};
Override the standard file picker completion callback
if(window.jsHarmonyCMSInstance) jsHarmonyCMSInstance.onFilePickerCallback = function(jdata){
if(overrideFilePicker){
//Handle response
var cms = jsHarmonyCMSInstance;
cms.filePickerCallback('path/to/path#@JSHCMS', jdata);
return true;
}
}