Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-17317

Custom fields prevent WYSIWYG editor loading (Drupal / WYSIWYG)

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Won't Fix
    • Affects Version/s: 4.6.8
    • Fix Version/s: None
    • Labels:
      None
    • Documentation Required?:
      None
    • Funding Source:
      Needs Funding

      Description

      Steps to reproduce

      • Configure Drupal to use Wysiwyg module with CKEditor
      • Configure CiviCRM to use Drupal builtin RTE
      • Edit an event; observe that event Description field has RTE applied
      • Add Custom Group to Event entity
      • Add Custom Field of type Note with RTE enabled to Event
      • Edit an event again
      • Note that RTE is applied to custom field but not description

      Initial debugging

      Tracing this down, it looks like loading the custom fields via AJAX is overwriting settings from the existing field. The WYSIWYG settings (Drupal.settings.wysiwyg populated inline during page render) appear to be -

      • Correctly initialised for the Description field when the first page load occurs. If the AJAX refreshes are blocked at this point, we have a trigger in Drupal.settings.wysiwyg.triggers['edit-description-value']
      • Overwritten with values for Description when the form is reloaded via AJAX (from civicrm/event/manage/settings?reset=1&action=update&id=11&component=event&qfKey=xxx&snippet=json)
      • Overwritten again with values for the custom field when the custom fields form is reloaded via AJAX (from civicrm/ajax/rest?entity=VolunteerCommendation&action=get&json=%7B%7D)

      The critical missing part seems to be that when the page finishes loading, we should have a value in Drupal.settings.wysiwyg.triggers for each of the RTE fields, but the only fields which are listed there are those contained in the second AJAX request.

      This might probably work if the two AJAX requests weren't happening simultaneously. I wonder if it's intended that the main form is rendered for initial output, AND then reloaded via AJAX?

      (Is there a switch to make this form just render its contents, without the extra two AJAX requests?)

      EDIT: OK, the content in the main form seems to be rendered but not output on initial display - rendering functions get called but there's no initial output. Might be just that we need to make the crmSnippet('refresh') calls that happen in CRM.loadPage() sequential or something. Will look at this again tomorrow.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              xurizaemon Chris Burgess
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: