Hi Marius,

Indeed it's more efficient to handle the conversion on the server side.
However, we need to have something quite generic if we want to be able 
to use the wysiwyg in complex cases.
A good approach would be to store a field  with the list of wysiwyg to 
convert.

However a filter directly in XWikiAction might be better than a servlet 
filter as it could allow us to avoid configuration.

Ludovic


Marius Dumitru Florea wrote:
> Hi devs,
>
> I'm trying to integrate the new WYSIWYG editor into XWiki's page editing
> mechanism and I'm having an issue regarding how the edited content is
> being submitted.
>
> Right now (correct me if I'm wrong) when the user clicks "Save & View" the
> edit form is submitted having a "content" field filled with the result of
> converting editor's HTML output to XWiki syntax. Two things should be
> noted:
> * the conversion takes place on the client side, in JavaScript code;
> * the save action, on the server side, expects XWiki code, not (X)HTML.
>
> In the case of the new WYSIWYG editor, converting the (X)HTML to XWiki on
> the client side is out of discussion. I must use the new rendering module,
> which is written in Java. In order to smoothly integrate the new editor I
> have to make sure the save action gets the XWiki code it expects.
>
> Asynchronously retrieving the result of the conversion before submitting
> the edit form is tricky due to the fact that the user can click "Save &
> View" before the response arrives.
>
> In light of this, Sergiu suggested me the following 2 solutions:
>
> A) Retrieve the conversion synchronously
> This would be easy if GWT would allow it. Instead I'd have to write
> error-prone code using timeout to wait for the response and then release
> the form submit.
>
> B) Use a servlet filter
> I'd have to write a servlet filter that detects the save action,
> determines the editor (wysiwyg, new_wysiwyg, wiki etc.) and the syntax of
> the submitted content (XWiki by default, XHTML for the new editor) and
> makes the conversion, if needed.
>
> I prefer the second solution. WDYT?
>
> Regards,
> Marius
>
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs
>
>   


-- 
Ludovic Dubost
Blog: http://blog.ludovic.org/
XWiki: http://www.xwiki.com
Skype: ldubost GTalk: ldubost

_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to