Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS

Adding custom button to Tiny_MCE


Reply

3 Posts   1030 Views

Avatar
AndrewMK

19 January 2009 at 12:04pm Community Member, 23 Posts

I have been reading some previous forum threads about the customising of TinyMCE and basically i have built a custom button for tiny MCE but cannot get it running what so ever.

What i have done so far is :
Created a new class /mysite/code/alternatetoolbar.php this contains a customised buttons function that returns all the buttons AND my custom button.
Edited /cms/code/leftandmain.php changed EditorToolbar function from 'return new HtmlEditorField_Toolbar($this, "EditorToolbar");' TO 'return Object::create('HtmlEditorField_Toolbar', $this, 'EditorToolbar');'
Added 'Object::useCustomClass('HtmlEditorField_Toolbar', 'AlternateToolbar');' to /mysite/_config.php
Added my plugin to the /jsparty/tiny_mce2/plugins directory
Added button image to /jsparty/tiny_mce2/themes/advanced/images

But absolutely nothing appears in the application!!!!

I tried editing the 'HtmlEditorField_Toolbar' and adding the button and whilst this added the button, the button did nothing when pressed!

If anyone can help please let me know.

Avatar
Sigurd

10 February 2009 at 5:32pm Forum Moderator, 628 Posts

Which version of SilverStripe are you using? This becomes easier in 2.3 ... :)

Avatar
AndrewMK

11 February 2009 at 8:44am Community Member, 23 Posts

Using 2.23 I got it working in the end but i had to edit the 'HtmlEditorField_Toolbar' instead of using my own function.