Last active
December 7, 2018 06:33
-
-
Save clivewalker/6f8152c899c23b822742611ecb8c8965 to your computer and use it in GitHub Desktop.
A config file to load additional plugins for Perch CMS default Redactor editor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Perch.UserConfig.redactor = function(){ | |
var get = function(profile, config, field) { | |
if (config.plugins.indexOf('source') === -1) config.plugins.push('source'); | |
if (config.plugins.indexOf('fontcolor') === -1) config.plugins.push('fontcolor'); | |
if (config.plugins.indexOf('alignment') === -1) config.plugins.push('alignment'); | |
return config; | |
}; | |
var load = function(cb) { | |
if (typeof jQuery.Redactor.prototype.source == 'undefined') { | |
jQuery.getScript(Perch.path+'/addons/plugins/editors/redactor-plugins/alignment.js', function() { | |
jQuery.getScript(Perch.path+'/addons/plugins/editors/redactor-plugins/fontcolor.js', function(){ | |
jQuery.getScript(Perch.path+'/addons/plugins/editors/redactor-plugins/source.js', cb); | |
}); | |
}); | |
} else { | |
cb(); | |
} | |
}; | |
return { | |
'get': get, | |
'load': load | |
} | |
}(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A config file to load additional Redactor plugins (View Source, Font Colour and Alignment) for Perch CMS. Based on the example at the bottom of this page. See also my post here.
This is a quick example that works on my site but there may be better ways of coding the
load
method for multiple scripts.