← Back to team overview

openerp-community team mailing list archive

Re: WYSIWYG in OpenERP

 

Hi Eric:
Great contribution! Thanks
Let me add a fix: As shipped the .js are not loaded in v6.1 because I guess
your are using an old flag "web_preload". It works only if you force load
with --load=web,web_display_html,web_wysiwyg
and an improvement: On web_wysiwyg, apply full editing only to text with
the widget=text_WYSIWYG
Attached the patch

Best regards

2012/5/11 Eric Caudal <eric.caudal@xxxxxxxxxxxxxx>

>  Hi Stefan,
> a simple example in product form:
>
> Original code is :
>                         <page string="Descriptions">
>                             <separator string="Description"/>
>                             <field colspan="4" name="description"
> nolabel="1"/>
>                             <separator string="Sale Description"/>
>                             <field colspan="4" name="description_sale"
> nolabel="1"/>
>                             <separator string="Purchase Description"/>
>                             <field colspan="4" name="description_purchase"
> nolabel="1"/>
>                         </page>
>
> New code would be :
>                         <page string="Descriptions">
>
>             <html>
>                 <a onclick="javascript:toggle_ckeditor();"class="wysiwyg_button wysiwyg_button_off oe_button">WYSIWYG on</a>
>             </html>
>                             <separator string="Description"/>
>                             <field colspan="4" name="description"
> widget="text_WYSIWYG" nolabel="1"/>
>                             <separator string="Sale Description"/>
>                             <field colspan="4" name="description_sale"
> nolabel="1"/>
>                             <separator string="Purchase Description"/>
>                             <field colspan="4" name="description_purchase"
> nolabel="1"/>
>                         </page>
>
> Upgrade the module and Voilà!
>
> About sanitizing: I agree that we did the minimum and it needs much better
> protection against injections. That will be soon in our next version :)
>
>
>
>
>   [image: openerp]
>
> *Eric CAUDAL*, Elico Corp, Shanghai.eric.caudal@xxxxxxxxxxxxxx
> Cell: + 86 186 2136 1670. Skype: elico.corp*Premium Certified Training Partner - OpenERP Ready Partner.*
>
>
> [image: Premium CTP]
> http://www.openerp.net.cn
>
> On 05/11/2012 04:50 PM, Stefan Rijnhart wrote:
>
> On 05/11/2012 03:05 AM, Eric Caudal wrote:
>
> You dreamt about it and we did it!
> We have developed 2 new modules for OpenERP 6.1 that allows you to include
> WYSIWYG capabilities in all your forms.
>
>
> Hi Eric,
>
> thank you for this great effort. You are right, I did dream about it and I
> tried out your modules immediately.
>
> It seems that the javascript functions that allow the functionality
> described are misnamed. According to the OpenERP web addons  functionality
> as I understand it, the functions need to be equal to the module names. I
> got the display module working with the folowing patch:
>
> === modified file 'web_display_html/static/src/js/web_displayHTML.js'
> --- web_display_html/static/src/js/web_displayHTML.js    2012-05-10
> 08:38:07 +0000
> +++ web_display_html/static/src/js/web_displayHTML.js    2012-05-11
> 08:20:54 +0000
> @@ -2,7 +2,7 @@
>   * OpenERP web_displayHTML
>   *---------------------------------------------------------*/
>
> -openerp.web_displayHTML = function (openerp) {
> +openerp.web_display_html = function (openerp) {
>      openerp.web.form.widgets.add('text_WYSIWYG',
> 'openerp.web.form.FieldText');
>      openerp.web.page.readonly.add('text_WYSIWYG',
> 'openerp.web_displayHTML.FieldWYSIWYGReadonly');
>
> How to get the editor working I have not yet been able to figure out. Can
> you explain more clearly how I should be able to add the HTML code that you
> mentioned to the view?
>
> With regards to the display module, I am a bit concerned about HTML
> sanitizing. Stripping the script tags may not be enough. As this is hardly
> a problem specific to your modules, more elaborate sanitation routines in
> Javascript can be found that you may be able to copy in to your module.
>
> The community list does not actually seem the right place for bug filing,
> so maybe you can open a dedicated Launchpad project for your modules?
>
> Thanks again for sharing the modules!
>
> Cheers,
> Stefan.
>
> --
> Therp - Maatwerk in open ontwikkeling
>
> Stefan Rijnhart - Ontwerp en implementatie
>
> mail: stefan@xxxxxxxx
> tel: +31 (0) 614478606http://therp.nlhttps://twitter.com/therp_stefan
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openerp-community
> Post to     : openerp-community@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openerp-community
> More help   : https://help.launchpad.net/ListHelp
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openerp-community
> Post to     : openerp-community@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openerp-community
> More help   : https://help.launchpad.net/ListHelp
>
>


-- 

Gustavo Adrian Marino

Mobile: +54 911 5498 2515

Email: gamarino@xxxxxxxxx

Skype: gustavo.adrian.marino

Attachment: elico.diff
Description: Binary data


Follow ups

References