When using the Insert module with CKEditor, it gets stuck in an endless loop.

In ckeditor-3.0.js there is this code:

  while (children.count() > skip) {
        item = children.getItem(skip);
        switch(item.type) {
          case 1:
            CKEDITOR.instances[this.field].insertElement(item);
            break;
          case 3:
            CKEDITOR.instances[this.field].insertText(item.getText());
            skip++;
            break;
          case 8:
            CKEDITOR.instances[this.field].insertHtml(item.getOuterHtml());
            skip++;
            break;
        }
      }

If it hits a point where item.type doesn't exist, it will never get out of the loop.

I added:

          default:
            skip++;

to get past those and it fixed the problem but I don't know if that's the best solution. If this is something the maintainer wants to add to the module, I can make a proper patch. Otherwise, I'm just noting it here for reference and in case anyone else runs into it.

Comments

Michelle created an issue. See original summary.

  • TwoD committed da6c86f on 6.x-2.x authored by Michelle
    - #3180717 by Michelle: Fixed endless loop with Insert and CKEditor
    
  • TwoD committed 4b51007 on 7.x-2.x authored by Michelle
    - #3180717 by Michelle: Fixed endless loop with Insert and CKEditor
    
twod’s picture

Status: Active » Fixed

Thanks, that change makes sense, sorry for the long delay!

michelle’s picture

Thanks! I've been around Drupal a long time and a commit in less than a year is not a "long delay". LOL!

Status: Fixed » Closed (fixed)

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