Ticket #13655 (new Bug)

Opened 3 years ago

Last modified 18 months ago

Problem with multiple editors on one page TinyMCE 1.3.4

Reported by: anonymous Owned by:
Priority: minor Milestone: 4.x
Component: Unknown Version: 4.3
Keywords: Cc:

Description

Problem with multiple editors on one page TinyMCE 1.3.4. Visible only first occurrence od editor, next is empty (no editor).

Change History

comment:1 Changed 3 years ago by davisagli

What version of Plone?

Is this an Archetypes or Dexterity based content type? Can you share your schema?

Are there any javascript errors?

comment:2 Changed 3 years ago by ableeb

This still seems to be a bug, Plone 4.3.2., Archetypes based content type. No javascript errors. Edit screen loads briefly, then all fields (including default I think) are loaded into the TinyMCE editor window, and only one TinyMCE editor appears.

Schema

"""Definition of the Training content type
"""

from zope.interface import implements

from Products.Archetypes import atapi
from Products.ATContentTypes.content import base
from Products.ATContentTypes.content import schemata

# -*- Message Factory Imported Here -*-
from uncsom.TeacchTraining import TeacchTrainingMessageFactory as _

from archetypes.referencebrowserwidget import ReferenceBrowserWidget

from uncsom.TeacchTraining.interfaces import ITraining
from uncsom.TeacchTraining.config import PROJECTNAME

TrainingSchema = schemata.ATContentTypeSchema.copy() + atapi.Schema((

    # -*- Your Archetypes field definitions here ... -*-

    atapi.ReferenceField(
        'contact',
        storage=atapi.AnnotationStorage(),
        widget=ReferenceBrowserWidget(
            label=_(u"Contact"),
            description=_(u"Contact for this training"),
            only_for_review_states = ("published",)
        ),
        #required=True,
        relationship='training_contact',
        allowed_types=('TeacchContact'), # specify portal type names here ('Example Type',)
        multiValued=False,
    ),

    atapi.ReferenceField(
        'sponsoringCenter',
        storage=atapi.AnnotationStorage(),
        widget=atapi.ReferenceWidget(
            label=_(u"Sponsoring Center"),
            description=_(u"Teacch regional center sponsoring this training"),
        ),
        relationship='training_traininglocation',
        allowed_types=('Teacch Center'), # specify portal type names here ('Example Type',)
        multiValued=False,
    ),

    atapi.TextField(
        'trainingLocation',
        storage=atapi.AnnotationStorage(),
        validators = ('isTidyHtmlWithCleanup',),
        default_output_type = 'text/x-html-safe',
        widget=atapi.RichWidget(
            label=_(u"Location"),
            description=_(u"Location for this training"),
        ),
    ),

    atapi.StringField('trainingLink',
        required=False,
        searchable=True,
        default = "http://",
        # either mailto, absolute url or relative url
        storage=atapi.AnnotationStorage(),
        validators = (),
        widget = atapi.StringWidget(
            description = 'An optional link to Location Facility, i.e. a hotel',
            label = _(u'Training URL')
            )),

    atapi.DateTimeField(
        'startdate',
        storage=atapi.AnnotationStorage(),
        widget=atapi.CalendarWidget(
            label=_(u"Start Date"),
            description=_(u"Starting date for this training (hint: click the small calendar icon)"),
            show_hm=False,
            format='%A %B %d, %Y',
        ),
        validators=('isValidDate'),
    ),

    atapi.DateTimeField(
        'enddate',
        storage=atapi.AnnotationStorage(),
        widget=atapi.CalendarWidget(
            label=_(u"End date"),
            description=_(u"Ending date of this training (hint: click the small calendar icon)"),
            show_hm=False,
            format='%A %B %d, %Y',
        ),
        validators=('isValidDate'),
    ),

    atapi.StringField(
        'category',
        storage=atapi.AnnotationStorage(),
        widget=atapi.SelectionWidget(
            label=_(u"Topic"),
            description=_(u"Category of this training"),
        ),
        vocabulary=['Adolescents and Adults', 'Assessments, Diagnosis, and Evaluations', 'Behavior Management',
                    'Communication, Social and Leisure', 'Early Intervention', 'High Functioning Autism',
                    'Five-Day Classroom Training','Advanced Topics',
                     'Structured TEACCHing','Lecture', 'Workshop','Hands-on'],

        enforce_vocabulary=False,
    ),


    atapi.TextField(
        'agenda',
        storage=atapi.AnnotationStorage(),
        validators = ('isTidyHtmlWithCleanup',),
        default_output_type = 'text/x-html-safe',
        widget=atapi.RichWidget(
            label=_(u"Agenda"),
            description=_(u"Agenda for this training"),
        ),
    ),


    atapi.LinesField(
        'presenters',
        storage=atapi.AnnotationStorage(),
        widget=atapi.LinesWidget(
            label=_(u"Presenters"),
            description=_(u"Presenters for this training"),
        ),
    ),


    atapi.TextField(
        'targetaudience',
        storage=atapi.AnnotationStorage(),
        validators = ('isTidyHtmlWithCleanup',),
        default_output_type = 'text/x-html-safe',
        widget=atapi.RichWidget(
            label=_(u"Target Audience"),
            description=_(u"Target audience for this training"),
        ),
    ),


    atapi.TextField(
        'content',
        storage=atapi.AnnotationStorage(),
        validators = ('isTidyHtmlWithCleanup',),
        default_output_type = 'text/x-html-safe',
        widget=atapi.RichWidget(
            label=_(u"Content"),
            description=_(u"Content for this training"),
        ),
    ),


    atapi.TextField(
        'objectives',
        storage=atapi.AnnotationStorage(),
        validators = ('isTidyHtmlWithCleanup',),
        default_output_type = 'text/x-html-safe',
        widget=atapi.RichWidget(
            label=_(u"Objectives"),
            description=_(u"Objectives for this training"),
        ),
    ),


    atapi.TextField(
        'continuingeducationcredits',
        storage=atapi.AnnotationStorage(),
        validators = ('isTidyHtmlWithCleanup',),
        default_output_type = 'text/x-html-safe',
        widget=atapi.RichWidget(
            label=_(u"Continuing Education Credits"),
            description=_(u"Description of contiuing eduction credits associated with this training"),
        ),
    ),


    atapi.TextField(
        'selection',
        storage=atapi.AnnotationStorage(),
        validators = ('isTidyHtmlWithCleanup',),
        default_output_type = 'text/x-html-safe',
        widget=atapi.RichWidget(
            label=_(u"Selection"),
            description=_(u"Description of the selection process for this training"),
        ),
    ),


    atapi.TextField(
        'cost',
        storage=atapi.AnnotationStorage(),
        validators = ('isTidyHtmlWithCleanup',),
        default_output_type = 'text/x-html-safe',
        widget=atapi.RichWidget(
            label=_(u"Cost"),
            description=_(u"Cost of this training. You can include text formatting"),
        ),
    ),


    atapi.TextField(
        'information',
        storage=atapi.AnnotationStorage(),
        validators = ('isTidyHtmlWithCleanup',),
        default_output_type = 'text/x-html-safe',
        widget=atapi.RichWidget(
            label=_(u"Information"),
            description=_(u"Information about this training. You can include the course contact, for example."),
        ),
    ),


    atapi.TextField(
        'accommodations',
        storage=atapi.AnnotationStorage(),
        validators = ('isTidyHtmlWithCleanup',),
        default_output_type = 'text/x-html-safe',
        widget=atapi.RichWidget(
            label=_(u"Accommodations"),
            description=_(u"A list of nearby hotels, motels, etc."),
        ),
    ),

    atapi.BooleanField(
        'tableContents',
         required = False,
         languageIndependent = True,
         widget = atapi.BooleanWidget(
             label= _(
                 u'help_enable_table_of_contents',
                 default=u'Table of contents'),
             description = _(
                 u'help_enable_table_of_contents_description',
                 default=u'If selected, this will show a table of contents at the top of the page.')
             ),
    )),
)

# Set storage on fields copied from ATContentTypeSchema, making sure
# they work well with the python bridge properties.

TrainingSchema['title'].storage = atapi.AnnotationStorage()
TrainingSchema['description'].storage = atapi.AnnotationStorage()

TrainingSchema['description'].widget.visible = { "edit" : "visible" }
TrainingSchema.moveField('startdate',after='description')
TrainingSchema.moveField('enddate',after='startdate')
TrainingSchema.moveField('trainingLocation',after='enddate')
TrainingSchema.moveField('trainingLink',after='trainingLocation')
TrainingSchema.moveField('contact',after='trainingLink')
TrainingSchema.moveField('sponsoringCenter',after='contact')
TrainingSchema.moveField('category',after='sponsoringCenter')
TrainingSchema.moveField('agenda',after='category')
TrainingSchema.moveField('presenters',after='agenda')
TrainingSchema.moveField('targetaudience',after='presenters')
TrainingSchema.moveField('content',after='targetaudience')
TrainingSchema.moveField('objectives',after='content')
TrainingSchema.moveField('continuingeducationcredits',after='objectives')
TrainingSchema.moveField('selection',after='continuingeducationcredits')
TrainingSchema.moveField('cost',after='selection')
TrainingSchema.moveField('information',after='cost')
TrainingSchema.moveField('accommodations',after='information')

schemata.finalizeATCTSchema(TrainingSchema, moveDiscussion=False)
TrainingSchema.changeSchemataForField('tableContents', 'settings')

class Training(base.ATCTContent):
    """TEACCH trainings content type"""
    implements(ITraining)

    meta_type = "Training"
    schema = TrainingSchema

    title = atapi.ATFieldProperty('title')
    description = atapi.ATFieldProperty('description')

    # -*- Your ATSchema to Python Property Bridges Here ... -*-
    contact = atapi.ATReferenceFieldProperty('contact')

    sponsoringCenter = atapi.ATReferenceFieldProperty('sponsoringCenter')

    trainingLocation = atapi.ATFieldProperty('trainingLocation')

    trainingLink = atapi.ATFieldProperty('trainingLink')

    accommodations = atapi.ATFieldProperty('accommodations')

    information = atapi.ATFieldProperty('information')

    cost = atapi.ATFieldProperty('cost')

    selection = atapi.ATFieldProperty('selection')

    continuingeducationcredits = atapi.ATFieldProperty('continuingeducationcredits')

    objectives = atapi.ATFieldProperty('objectives')

    content = atapi.ATFieldProperty('content')

    targetaudience = atapi.ATFieldProperty('targetaudience')

    presenters = atapi.ATFieldProperty('presenters')

    agenda = atapi.ATFieldProperty('agenda')

    category = atapi.ATFieldProperty('category')

    enddate = atapi.ATFieldProperty('enddate')

    startdate = atapi.ATFieldProperty('startdate')

atapi.registerType(Training, PROJECTNAME)

comment:3 Changed 18 months ago by davideilmoro

I have a similar problem with multiple richwidgets on archetypes (don't know if dexterity content types are affected).

If I enable two or more richwidget I get a javascript error:

Errore: nessun elemento trovato (no elements found)
File sorgente: <object_path...>//@@plone_lock_operations/refresh_lock

Errore: nessun elemento trovato (no elements found)
File sorgente: <object_path...>//@@plone_lock_operations/safe_unlock

comment:4 Changed 18 months ago by davideilmoro

I've tried with Dexterity and all works fine. Maybe there is a problem in your (and my) plugin code or an archetypes specific issue.

comment:5 Changed 18 months ago by davideilmoro

I've tried raptus.article.additionalwysiwyg and it works fine with multiple richtext fields, so you can have a look how they have implemented it.

This ticket could be closed.

Note: See TracTickets for help on using tickets.