Here I want to tell something I have learned using this nice toy.
Use with Maven 2
To use tinymce in a Maven 2 project, we need to add the wicketstuff maven2 repository:
Creating a CheckBox that toggle TinyMceBehavior on and off.
In my scenario I need the user to enable Rich Text capabilities for a field in a form. Is nothing complicated but we need to take care about when to instantiate objects. In my solution, I use a checkbox to toggle the state. This is the code I have in the constructor of my panel.
The information is saved in a property called “rich” in my domain object so it is persisted and I can remember next time. That object is already wrapped in the variable model (a wicket IModel) that in this code is wrapped in a simple wicket PropertyModel. In this example I have used Wicket 1.4 support for generics.
Switching to Rich Text after the page is load
Maybe anyone knew this before. I did not. When you submit a form containing a TinyMCE component and the form submits via ajax, say an AjaxSubmitLink or an AjaxButton in Wicket, you *must* use a trick as someone else already explained. With wicket-tinymce this becomes adding the TinyMceAjaxSubmitModifier to the submit component and that’s all.
wicket-contrib-tinymce is a well done contribution to the wicketstuff-core and an important library for web developer that uses Wicket. The only small point is that is actually using a one year old version of TinyMCE, dated august 2008. It does the *most* of the stuff and I never felt the need to upgrade. Maybe someone just need some feature or a bug fix present in more recent release. Hope that wicket-tinymce developer will have some time to play with newer TinyMCE.
This is my first contribution to WicketByExample. I hope you liked the article, I will like any feedback. Cheers.
Speaking at Confoo
We develop software that helps you reach more customers.
Front end development and NoSQL solutions are our specialty and more…
Mystic has consulted with us on many of our applications, provided penetration testing to assess security readiness, and kept the servers humming along with our mish-mash of hardware and software that was required. They redesigned the network architecture to better support our growing needs and were always available for questions or concerns a phone call away.