5.7.4 - Has anyone been able to register a Redactor plugin?

Permalink
I have unsuccessfully attempted to register a Redactor plugin by using this example.
https://www.concrete5.org/documentation/developers/5.7/interface-cus...

Here are the paths I used for the package:
packages\clips_plugin\editor\plugin\clips\js\redactor\clips.js
packages\clips_plugin\editor\plugin\clips\css\redactor\clips.css

The plugin package can be installed and enabled in the new Rich Text Editor settings page (Dashboard > System & Settings > Basics > Rich Text Editor), but prevents Redactor from loading.

The Redactor plugin is called clips.js and is supplied by the maker of Redactor as an example. When manually added to concrete5 (with the addition of this.lang.get() and setAwesome()) the plugin works as expected. It is unmodified, except for two changes.
http://imperavi.com/webdownload/redactor/plugin/?plugin=clips...

Original clips.js
var button = this.button.add('clips', 'Clips');
this.button.addCallback(button, this.clips.show);

Modified to work with concrete5
var button = this.button.add("clips-button", this.lang.get("insert_clips"));
this.button.setAwesome("clips-button", "fa-clipboard");


I am attaching the plugin so others might see where I am making an error.

1 Attachment

MrKDilkington
 
csebe replied on at Permalink Reply
Andrew said in the original post: "Note: this requires concrete 5.7.4 (and it's just been added so it's not part of the release candidate) ".

I assume you're working with RC2?
MrKDilkington replied on at Permalink Reply
MrKDilkington
I am using version 5.7.4.
WebcentricLtd replied on at Permalink Best Answer Reply
if you structure like so

packages/clips_plugin/js/redactor/clips.js
packages/clips_plugin/css/redactor/clips.css

I think you'll find it works.
You need to discard /editor/plugin/clips and move your js and css directories into the root of your package.
MrKDilkington replied on at Permalink Reply
MrKDilkington
Thank you, that structure worked.

Also, for anyone else reading this in the future, you do not need "this.lang.get()" for the tooltip names.

The only thing concrete5 needs to get it running is setAwesome() which sets the Font Awesome icon in the toolbar.
WebcentricLtd replied on at Permalink Reply
by the way - thanks for the plugin. I'm just using it to add placeholder text to a demo site. It's come in very handy...
MrKDilkington replied on at Permalink Reply
MrKDilkington
For you, or anyone else, making plugins.

Here are some example plugins I've found. Even if the plugin function itself isn't what you want, I find seeing how they were built very useful.

http://imperavi.com/redactor/plugins/...
https://github.com/modmore/redactor-plugins...
https://github.com/vint21h/redactor-plugins-lineheight...
http://carstenschaefer.github.io/...

There don't seem to be a ton of Redactor 10 plugins around.