Problem/Motivation

Mercury Editor can't be used with Drupal core 10.3

Steps to reproduce

After upgrading to Drupal core from 10.2 to 10.3, you would notice that you can't use Mercury Editor anymore.

Proposed resolution

Looks like this might be the reason https://www.drupal.org/node/3422670

Remaining tasks

@TODO

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

D34dMan created an issue. See original summary.

d34dman’s picture

I was trying to see if I can fix this issue. While trying to compile the source file, I notice that it tries to build from `modules/mercury_editor_inline_editor` as well. But looks like it is safe to ignore that?

d34dman’s picture

Assigned: d34dman » Unassigned

jhina.riv@gmail.com made their first commit to this issue’s fork.

jhina.riv@gmail.com changed the visibility of the branch 3456410-closing_bootstrap_modal_dialog to hidden.

pbabin’s picture

We are experiencing the same issue with ME and upgrading to 10.3

alison’s picture

Same here! I go into the node editing form (existing basic page with mercury editor enabled, and layout paragraphs functionality), and I get this in browser console (Firefox on Windows 11):

Uncaught TypeError: event is undefined
    handle https://my-site.pantheonsite.io/core/misc/dialog/dialog-deprecation.js?v=10.3.0:12
    jQuery 7
    openDialog https://my-site.pantheonsite.io/modules/contrib/mercury_editor/build/js/dialog.drupal.js?sfp58z:194
    show https://my-site.pantheonsite.io/modules/contrib/mercury_editor/build/js/dialog.drupal.js?sfp58z:217
    attach https://my-site.pantheonsite.io/modules/contrib/mercury_editor/build/js/edit-screen.js?sfp58z:168
    attachBehaviors https://my-site.pantheonsite.io/core/misc/drupal.js?v=10.3.0:166
    attachBehaviors https://my-site.pantheonsite.io/core/misc/drupal.js?v=10.3.0:162
    <anonymous> https://my-site.pantheonsite.io/core/modules/big_pipe/js/big_pipe.js?v=10.3.0:153
    <anonymous> https://my-site.pantheonsite.io/core/modules/big_pipe/js/big_pipe.js?v=10.3.0:184
dialog-deprecation.js:12:24

When I click the "plus" icon, it loads the paragraph picker dialog, but there's this in console:

An error occurred during the execution of the Ajax response: TypeError: event is undefined ajax.js:1147:19
    success https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:1147
    (Async: promise callback)
    success https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:1145
    success https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:588
    jQuery 6
    execute https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:711
    lpbUiClick https://my-site.pantheonsite.io/modules/contrib/mercury_editor/build/js/post-messages-listener.js?sfp58z:14
    attach https://my-site.pantheonsite.io/modules/contrib/mercury_editor/build/js/post-messages-listener.js?sfp58z:59

Then I pick a paragraph type (button, in my case, because it's simple, just a plain text field and a link URL field), and the next dialog loads, but I get this in console:

An error occurred during the execution of the Ajax response: TypeError: event is undefined ajax.js:1147:19
    success https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:1147
    (Async: promise callback)
    success https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:1145
    success https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:588
    jQuery 6
    eventResponse https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:803
    Ajax https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:650
    jQuery 8
    Ajax https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:639
    ajax https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:267
    bindAjaxLinks https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:335
    bindAjaxLinks https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:307
    attach https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:54
    attachBehaviors https://my-site.pantheonsite.io/core/misc/drupal.js?v=10.3.0:166
    attachBehaviors https://my-site.pantheonsite.io/core/misc/drupal.js?v=10.3.0:162
    insert https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:1393
    jQuery 2
    insert https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:1385
    openMercuryDialog https://my-site.pantheonsite.io/modules/contrib/mercury_editor/build/js/dialog.ajax.js?sfp58z:43
    commandExecutionQueue https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:1050
    (Async: promise callback)
    commandExecutionQueue https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:1043
    commandExecutionQueue https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:1040
    success https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:1099
    success https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:588
    jQuery 6
    execute https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:711
    lpbUiClick https://my-site.pantheonsite.io/modules/contrib/mercury_editor/build/js/post-messages-listener.js?sfp58z:14
    attach https://my-site.pantheonsite.io/modules/contrib/mercury_editor/build/js/post-messages-listener.js?sfp58z:59

Then, I fill in the two simple fields, and hit "Save" -- nothing happens, dialog stays up, no button is added to my layout -- and I get this in console:

An error occurred during the execution of the Ajax response: TypeError: event is undefined ajax.js:1147:19
    success https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:1147
    (Async: promise callback)
    success https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:1145
    success https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:588
    jQuery 9
    eventResponse https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:800
    Ajax https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:650
    jQuery 8
    Ajax https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:639
    ajax https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:267
    loadAjaxBehavior https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:47
    loadAjaxBehavior https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:44
    attach https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:52
    attachBehaviors https://my-site.pantheonsite.io/core/misc/drupal.js?v=10.3.0:166
    attachBehaviors https://my-site.pantheonsite.io/core/misc/drupal.js?v=10.3.0:162
    insert https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:1393
    jQuery 2
    insert https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:1385
    openMercuryDialog https://my-site.pantheonsite.io/modules/contrib/mercury_editor/build/js/dialog.ajax.js?sfp58z:43
    commandExecutionQueue https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:1050
    (Async: promise callback)
    commandExecutionQueue https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:1043
    commandExecutionQueue https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:1040
    success https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:1099
    success https://my-site.pantheonsite.io/core/misc/ajax.js?v=10.3.0:588
    jQuery 3

"Cancel" also doesn't work, but the "X" at the top-right of the dialog does work, so that's how I make my escape.

justin2pin made their first commit to this issue’s fork.

justin2pin’s picture

Status: Active » Needs review

Hopefully MR55 is the ticket - this change dispatches the custom DrupalDialogEvent instead of using jQuery's trigger. This needs testing for backwards compatibility.

pbabin’s picture

Patched with MR55 in Drupal 10.3 without an issue and confirmed previous failing Cypress tests on our end our now passing. Thank you @just2pin for such a quick update.

sethhill’s picture

I installed this patch into a D10.2 site to test, and get this error:

Uncaught ReferenceError: DrupalDialogEvent is not defined

So this MR requires 10.3 as it stands at this moment.

alison’s picture

MR55 works for me on 10.3, too (was going to test on 10.2.6 buuuut thank you @sethhill for already doing that!)

sethhill’s picture

Status: Needs review » Reviewed & tested by the community

Tested on 10.2 and 10.3, and the latest changes seem to work well.

  • justin2pin committed c38abb85 on 2.1.x
    Issue #3456410 by justin2pin, D34dMan, jhina.riv@gmail.com, pbabin,...
justin2pin’s picture

Status: Reviewed & tested by the community » Fixed
smurfxx’s picture

Has this patch already been deployed or does it need to be applied manually? I wanted to test Mercury Editor but I'm on Drupal 10.3.0 and I'm getting the AJAX error shown above.

d34dman’s picture

Has this patch already been deployed or does it need to be applied manually? I wanted to test Mercury Editor but I'm on Drupal 10.3.0 and I'm getting the AJAX error shown above.

@smurfxx, are you testing using 2.1.x-dev version?

smurfxx’s picture

Yes, I'm testing the 2.1.0+9-dev version

Status: Fixed » Closed (fixed)

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