This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

pxpx
pxpx

Hi guys,

What would be the quickest surefire way without editing any core files of extending the redactor functionality to add a simple image browser to allow clients to insert images into the content?

Many thanks, Jon

that0n3guy
that0n3guy

This is a great question, and I have 2 partial answers for you :).

Since you have to override javascript, I have no idea how to do this the "right" way.

That said, a temporary fix (till a better way comes up) would be to do destroy the redactor instance and add your own. Something like:

$('.field-richeditor textarea').redactor('core.destroy');
$('.field-richeditor textarea').redactor({
    buttons: ['formatting', 'bold', 'italic', 'deleted'],
    othersettings: gohere,
});

Another idea is to extend the redactor api (see the "External access to API" on http://imperavi.com/redactor/docs/api/). I only tested this a little bit, you can add a button like $('.field-richeditor textarea').redactor('button.image'); but that button doesn't do anything.

pxpx
pxpx

Thanks for the info. We are new to the CMS, so it certainly helps to be given a few bones here and there :) I hadn't thought about going through the API for redactor to be honest, so I may start there. Although the changes we would like to make would affect the RadiantWeb's ProBlog and the StaticPages plugins, so I will need to figure out a way of plugging in there somewhere without adapting the plugin code also.

This certainly gives me a heads up, so thank you very much for the swift response :)

that0n3guy
that0n3guy

I'm pretty sure ProBlog and StaticPages both use octobers default richeditor. So you're not really plugging into those.

What your wanting to do is planned, see: https://github.com/octobercms/october/pull/636

The editor is being worked on a lot lately, I've seen lots of changes too it (buttons appearing on one update, disappearing another update, etc..). So actually, removing the whole instance, then re-adding it might be "better" while in beta because you know an update won't screw it up. If you use the redactor api, you might be adding buttons that will get added later by an october update and then you have 2 image buttons :).

pxpx
pxpx

Yes totally agree, I will look into your other option for the time being then as it's on a website we are trying to get ready for launch. We are only just adopting the CMS so finding out the limitations on a case by case basis at the moment. Glad there are solutions though :)

I will keep on top of that pull request too.

Thanks again.

1-5 of 5

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.