I'm creating some custom content types using dexterity. I would like to "customize" the aspect of a RichText Field allowing only basic buttons of TinyMce on this field.
In Archetypes I could use
TextField('text',
allowable_content_types=('text/html',),
default_output_type='text/x-html-safe',
required=1,
widget=RichWidget
(label='Content',
allow_buttons=(
'bold',
'italic',
'justifyleft',
'justifyright',
),
),),
How would I do this with Dexerity based contenttypes?
There doesn't appear to be a "nice" way to do this right now. Even the Plone docs are currently at a loss. http://docs.plone.org/develop/plone/forms/wysiwyg.html#id9
The problem lies with Products.TinyMCE trying to get the WYSIWYG configuration from the widget attribute of the Field.
https://github.com/plone/Products.TinyMCE/blob/1.3.6/Products/TinyMCE/utility.py#L711-L713
But, as I understand, with Dexterity we instead map fields to widgets on the form object.
So, our body field possesses no widget attribute from which Products.TinyMCE can extract configurations.
At any rate, if you need it to work right now, I was able to hack it by doing the following:
In your ZMI, customize portal_skins/tinymce/tinymce_wysiwyg_support to change the line
field field|nothing
tofield field|view/field|nothing
.Define your content type in a schema-driven fashion, and for your WYSIWYG field do the following: