I am trying to revive this blog from a long period of sleep. Let's start today with a little Java trick I made to have a working TinyMCE implementation using Wicket (tested over 1.4.9 and 1.4.13 in my case but I think it should work for any 1.4.x at least, please report successful attempts under other releases).
An implementation of TinyMCE for Wicket exists, it'll be the first result you get when you ask your old pal G***** a hand. But, this implementation is a bit tricky to find (outdated links everywhere) and not feature complete (or not fully complete), as I explain in the read more part...
You can checkout latest almost working release from there by using the following command line :
Let me explain what problem I encountered, it happens only on
isolated cases (ajax pushing the whole WYSIWYG shebang on a page
without that mess). TinyMCE is then lost, and the only output you
get when you try to call init() is
first thought was to replace the outdated version bundled (126.96.36.199),
so I headed to TinyMCE's website , downloaded latest version so far
(188.8.131.52) and replaced it in my workspace. A try later and no luck,
the problem is still here.
What's happening, why on hell this working component don't want to
work anymore ? By digging into TinyMCE's code, you'll find that it
looks for its baseURL, for lazy loading stuffs (depending on what
you use), but Wicket responds to Ajax headers contribution in a
special way : instead of appending regular
to the body of the document.
This particular way of answering to browser is not well handled by
TinyMCE, which looks up its baseURL by parsing script tags present
in the DOM. The hack to circumvent this is really simple, make
TinyMCE find its baseURL by reacting on src_ attributes. The
following listing shows the patch in
With this hack, console error yelling
tinyMCE is undefined is gone. No more error but the
editor still does not work, TinyMCE waits for the document to be
ready before calling its render phase. Let's fake it by flagging
when we're coming from a Wicket Ajax request. We simply add an
attribute to tinyMCE object : in the
We flag in the
getBase(n) when we come from Wicket Ajax
(when we get something like
and we set the
domLoaded flag to the newly introduced
This way, TinyMCE calls its render phase directly when we call
init() on tinyMCE object. This call is done by Wicket
when the dom is ready and then we finally got TinyMCE working even
need to do in order for this to work in deployment mode is to
compress tiny_mce_src.js to tiny_mce.js with this patch.
You can find the resulting