Reputation: 65
Users of my Wicket application should be able to edit some of the panels' output (X)HTML. There will be a button or link on each panel that, when clicked, will get the rendered content and use/open an editor such as TinyMCE.
I think I want some sort of getRenderedXTML()
method for the panel, but have no clue how to get the rendered output programmatically. How can I do this?
Upvotes: 0
Views: 280
Reputation: 41145
You can likely get the generated html just before it's sent to the browser, but this is a bad approach as reconnecting the edited html back the the generating fragments will be painful if not impossible.
Rather than actually trying to edit the dynamic markup, make the user-editable stuff part of the data. Show it in a Label
and use setEscapeModelStrings(false)
to allow the label to properly render the html fragment. On click of your link, replace that label with a textarea with tinymce behavior attached.
There is a some tinymce support in wicketstuff-core that can help with this, and this Wicket by Example article shows a bit of how to use it, though it may be a bit out-of-date, and references document locations no longer available.
Upvotes: 2