Comments

Sam152 created an issue. See original summary.

sam152’s picture

Under certain circumstances, errors are triggered from editor.js which cause the panels UI to break and dump JSON commands to the screen.

sam152’s picture

Status: Active » Needs review

Here is the fix I have so far. It would perhaps be good to understand how things get into the broken state, it looks primarily related to missing JavaScript settings as a result of no 'editor' being selected for a particular input format, but it's still possible with out of the box settings to trigger it.

The fix could be the right solution, as the same check is further down the file:

detach: function (context, settings) {
      var $context = $(context);
      $context.find('.filter-list:input').each(function () {
        var $this = $(this);
        var activeEditor = $this.val();
        var field = $this.closest('.text-format-wrapper').find('textarea').get(-1);
        if (field && Drupal.settings.editor.formats[activeEditor]) {
          Drupal.editorDetach(field, Drupal.settings.editor.formats[activeEditor]);
        }
sam152’s picture

StatusFileSize
new495 bytes
devin carlson’s picture

Title: TypeError: Cannot read property 'editor' of undefined breaks Drupal commons IPE. » Fix JavaScript error when submitting a form that has a text_format selector set to a text format without associated text editor
Priority: Normal » Major
StatusFileSize
new550 bytes

Thanks for the patch!

Retitling as this is a backport of #2031529: Fix JavaScript error when submitting a form that has a text_format selector set to a text format without associated text editor and attaching a slightly modified patch to stay in sync with D8.

sam152’s picture

Didn't think to check the core queue for the same module, thanks for looking at this.

devin carlson’s picture

Status: Needs review » Fixed

Tested #5 and committed to Editor 7.x-1.x.

  • Devin Carlson committed c7cf917 on 7.x-1.x authored by Sam152
    Issue #2624030 by Sam152, Devin Carlson: Fix JavaScript error when...

Status: Fixed » Needs work

The last submitted patch, 5: only_detach_editor_for_formats_with_editors-2624030-5.patch, failed testing.

devin carlson’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.