We've had reports that the LinkIt button will not trigger the modal popup. We've also received this error

TypeError: undefined is not an object (evaluating 'Drupal.settings.linkit.fields[editor.id]')

It's pretty easy to replicate, and the issue might be in the root of the WYSIWYG module.

  1. Create a new piece of content
  2. Change the body field's text filter to panopoly_html_text and add some demo text.
  3. Save the node.
  4. Edit the node you just saved
  5. Change the body field's text filter to panopoly_wysiwyg_text
  6. Attempt to use the LinkIt button
  7. Come up empty handed, find error in console.

At first I figured this to be a WYSIWYG module bug. But after typing out the reproduction steps and reading the error, I think it's within LinkIt itself. WYSIWYG is properly loading the JS files, but on behaviors attach the settings aren't being populated.

Note: I posted the initial issue here rather than LinkIt because it was discovered using Panopoly. Not 100% sure it is LinkIt and not WYSIWYG. People will be more prone to file the report here if they discover it versus the other contirb modules.

Comments

mcrittenden’s picture

This seems to be due to linkit_pre_render_editor_element() only caring about which text format is active when initially loading the page, and ignoring the change when you manually change it (from HTML to WYSIWYG). Still not sure if it's a linkit bug or a WYSIWYG bug though. Will dig in a bit more.

mcrittenden’s picture

Status: Active » Closed (duplicate)

Dupe of #2115763: Linkit editor button errors out after switching WYSIWYG text format against Linkit. Will be posting a patch there shortly.

mglaman’s picture

Status: Closed (duplicate) » Active
Related issues: +#2115763: Linkit editor button errors out after switching WYSIWYG text format

Then we should patch Panopoly to use the patch.

mcrittenden’s picture

Status: Active » Needs review

Cool, here's a patch for panopoly_wysiwyg which brings in the patch from #2115763.

mcrittenden’s picture

dsnopek’s picture

Status: Needs review » Fixed

Thanks, @mcrittenden! You patch works in my testing. :-) Committed!

  • dsnopek committed 2572001 on 7.x-1.x
    Update Panoploy WYSIWYG for Issue #2460217 by mcrittenden: LinkIt is...

Status: Fixed » Closed (fixed)

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

mcrittenden’s picture

To close the loop, the patch was committed to Linkit. #2115763: Linkit editor button errors out after switching WYSIWYG text format