Personalize SiteHandler.js

Hi to all,
I want to do personalizations on the code in lib/pkp/js/controllers/SiteHandler.js

In particular I want to work on TinYMCE setup:
$.pkp.controllers.SiteHandler.prototype.initializeTinyMCE =
function() { … } // lines 129 - 178

$.pkp.controllers.SiteHandler.prototype.triggerTinyMCESetup =
function(tinyMCEObject) { … } // lines 201 -304

I don’t want to change the origial file.
Is it possible to do an override and use a ‘personal’ .js file ?
Can you write same instructions on how to do this type of personalization ?

Zeno Tajoli

Hi @ztajoli,

You can overwrite the default TinyMCE params with the following JavaScript:

$.pkp.plugins.tinymceplugin.tinymceParams = $.extend({}, $.pkp.plugins.tinymceplugin.tinymceParams, {
  // Add your config options here

The easiest way to add this while keeping your customization separate from the core code (good idea :+1:) is to write a tiny plugin. You can copy how the TinyMCE plugin loads its JavaScript. First, it registers a template callback hook:

And in the call back it fires $templateMgr->addJavaScript: