Forum

Thread tagged as: Question, Configuration, Redactor

Redactor Image Uploads without Shortcode

Reference: https://forum.grabaperch.com/forum/07-07-2018-redactor-image-uploads-without-shortcode

I am trying to disable shortcodes for images from Redactor with a custom configuration (so the customer can see the image instead of the shortcode)

As directed in the post (link above), I have defined the plugins and not included perchassets. But this has the effect of removing the image and file buttons from the Redactor editor.

My config:

Perch.UserConfig.redactor = function(){

var get = function(profile, config, field) {

if (config.plugins.indexOf('fontcolor') === -1) config.plugins.push('fontcolor');
if (config.plugins.indexOf('alignment') === -1) config.plugins.push('alignment');

//alert(config.plugins.join('\n'));

// define our own array, thus getting rid of 'perchassets'
config.plugins = ['fontcolor', 'alignment'];

return config;
};

var load = function(cb) {
// if (typeof jQuery.Redactor.prototype.source == 'undefined') {
jQuery.getScript(Perch.path+'/addons/plugins/editors/redactor-plugins/alignment.min.js', function(){
jQuery.getScript(Perch.path+'/addons/plugins/editors/redactor-plugins/fontcolor.min.js', cb);
});

// } else {
// cb();
// }
};

return {
'get': get,
'load': load
}

}();
Simon Clay

Simon Clay 127 points

  • 2 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

But this has the effect of removing the image and file buttons from the Redactor editor.

Yes, those are provided by the perchassets plugin. You'll need to enable some other plugin to handle file and image uploads if you opt out of the one provided. I think the details might just be called file and image but check the Redactor docs to be sure.