plone / plone.app.widgets

Integrating plone.widgets into plone
Other
7 stars 38 forks source link

PloneFormGen 1.7.19: No TinyMCE in formEpilogue & FormRichTextField #140

Closed Gomez closed 7 years ago

Gomez commented 8 years ago

I installed plone.app.widgets == 1.8.0 in my Plone 4.3.7 site, everything is fine but PloneFormGen does not show up with TinyMCE. If i disable pa.widgets it works again with the old PloneFormGen.

Has someone with PloneFormGen on pa.wigets running? Or is there a other way?

petschki commented 7 years ago

maybe too late but for the record. I've fixed this issue with a custom extender in my theme product:

extender.py:

from Products.ATContentTypes.interface import IATContentType
from archetypes.schemaextender.interfaces import IBrowserLayerAwareExtender
from archetypes.schemaextender.interfaces import ISchemaModifier
from plone.app.widgets import at
from plone.app.widgets.interfaces import IWidgetsLayer
from zope.component import adapts
from zope.i18nmessageid import MessageFactory
from zope.interface import implements

_plone = MessageFactory('plone')

class MetadataExtender(object):
    """
    """

    implements(ISchemaModifier, IBrowserLayerAwareExtender)
    adapts(IATContentType)
    layer = IWidgetsLayer

    def __init__(self, context):
        self.context = context

    def fiddle(self, schema):
        for field in schema.fields():
            old = field.widget

            if field.__name__ in [
                    'formPrologue', 'formEpilogue',
                    'thanksPrologue', 'thanksEpilogue',
                    'noSubmitMessage']:
                field.widget = at.TinyMCEWidget(
                    label=old.label,
                    description=old.description,
                )

configure.zcml:

...
<adapter
      name="plonetheme.yourtheme"
      factory=".extender.MetadataExtender"
      for="Products.ATContentTypes.interface.IATContentType"
      provides="archetypes.schemaextender.interfaces.ISchemaModifier"
      />
...
davisagli commented 7 years ago

FWIW, I fixed this a different way, by overriding the tinymce_wysiwyg_support template in Products.TinyMCE to set the same pattern options that are used for the plone.app.widgets widgets. That makes it work both for this and for other cases that use that template (such as the static text portlet, which is still formlib-based in Plone 4.3).