Here's a class I created which extends the default TinyMCESettings class. I use
this as my configuration and can customise it to my hearts content, adding and
removing buttons:
/**
* A configuration class for the TinyMCE Wicket component, used by textareas.
* If more are required for different purposes, create a new class.
*/
public class TextareaTinyMceSettings extends TinyMCESettings {
private static final long serialVersionUID = 1L;
public TextareaTinyMceSettings () {
super(TinyMCESettings.Theme.advanced);
/*
add(Button.bullist, TinyMCESettings.Toolbar.first,
TinyMCESettings.Position.after);
add(Button.numlist, TinyMCESettings.Toolbar.first,
TinyMCESettings.Position.after);
disableButton(Button.styleselect);
disableButton(Button.sub);
disableButton(Button.sup);
disableButton(Button.charmap);
disableButton(Button.image);
disableButton(Button.anchor);
disableButton(Button.help);
disableButton(Button.code);
disableButton(Button.link);
disableButton(Button.unlink);
disableButton(Button.formatselect);
disableButton(Button.indent);
disableButton(Button.outdent);
disableButton(Button.undo);
disableButton(Button.redo);
disableButton(Button.cleanup);
disableButton(Button.hr);
disableButton(Button.visualaid);
disableButton(Button.separator);
disableButton(Button.formatselect);
disableButton(Button.removeformat);
*/
List<Button> firstRowButtons = new ArrayList<Button>();
firstRowButtons.add(Button.bold);
firstRowButtons.add(Button.italic);
firstRowButtons.add(Button.underline);
firstRowButtons.add(Button.strikethrough);
firstRowButtons.add(Button.separator);
firstRowButtons.add(Button.sub);
firstRowButtons.add(Button.sup);
firstRowButtons.add(Button.separator);
firstRowButtons.add(Button.link);
firstRowButtons.add(Button.unlink);
firstRowButtons.add(Button.separator);
firstRowButtons.add(Button.bullist);
firstRowButtons.add(Button.numlist);
firstRowButtons.add(Button.separator);
firstRowButtons.add(Button.code);
//set first toolbar
setToolbarButtons(TinyMCESettings.Toolbar.first,
firstRowButtons);
//remove the second and third toolbars
setToolbarButtons(TinyMCESettings.Toolbar.second, new
ArrayList<Button>());
setToolbarButtons(TinyMCESettings.Toolbar.third, new
ArrayList<Button>());
setToolbarButtons(TinyMCESettings.Toolbar.fourth, new
ArrayList<Button>());
setToolbarAlign(TinyMCESettings.Align.center);
setToolbarLocation(TinyMCESettings.Location.top);
setStatusbarLocation(null);
setResizing(true);
setHorizontalResizing(true);
}
}
It's then used like so:
TextArea otherInformation = new TextArea("otherInformation", new
PropertyModel(userProfile, "otherInformation"));
//add TinyMCE control
otherInformation.add(new TinyMceBehavior(new TextareaTinyMceSettings()));
You might be able to play with the settings above to find what you need. Check
out the settings available in the base class.
cheers,
Steve
On 13/01/2010, at 9:43 AM, fachhoch wrote:
>
> I did as you said , recreated , the jar using latest js files . Please
> tell me what setting I should add to add spell checker and to make copy from
> word and paste to tinymce ?
>
> Linkan wrote:
>>
>> You have to download the source and repack it with new javascripts to
>> make it work.
>> http://old.nabble.com/making-tinymce-textarea-read-only-td23160313.html#a23170821
>>
>> //Swanthe
>>
>> tubin gen wrote:
>>> I ma trying to make TextArea with TinyMce behaviour readonly , I added
>>> the following custom settings but it did not work
>>> tinyMCESettings.addCustomSetting("readonly : true");
>>> tinyMCESettings.addCustomSetting("mode : textareas");
>>>
>>> please suggest me how to make it readonly ?
>>>
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>>
>
> --
> View this message in context:
> http://old.nabble.com/making-tinyMce-TextArea-readonly-tp26611935p27136175.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>