Gin RC13, Mercury Editor, and Save

Created on 18 July 2024, 9 months ago
Updated 15 August 2024, 8 months ago

Problem/Motivation

I'm using Mercury Editor 2.1.1 on Drupal 10.3.1 and we have Gin 3.0-RC13 installed. Gin has a gin_form_after_build() that is unsetting $form['actions']. This results in the save button disappearing due to /mercury_editor/source/js/edit-screen.js line 100 document.querySelector('#me-save-btn').remove();. The previous query for data-drupal-selector="edit-submit" isn't found due to that gin_form_after_build unsetting the form actions.

The first indication of an issue was https://www.drupal.org/project/gin/issues/3459995 πŸ› null is not an object (evaluating 'newParent.querySelectorAll') Fixed where Gin made an update; however, the issue became more compounded after additional testing revealed we are not able to save.

There is a corresponding issue with Gutenberg that looks like it proposes a solution but I wanted to bring attention to it here.

Gutenberg is adding some attributes to the form and then in Gin they are adding an if statement to not unset the form actions if Gutenberg is installed. https://www.drupal.org/project/gin/issues/3460150 πŸ› Save button missing when using the Gutenberg/Mercury editor module Fixed

Proposed resolution

I'm proposing that Gin also modify not to unset the form actions if
!isset($form['#gutenberg_enabled']) && !str_contains($form['#form_id'], 'mercury_editor').

I'm hopeful that this is a relatively easy fix but wanted to loop Mercury Editors into this if they are also using Gin.

At this time nothing to be done for Mercury Editor unless there is something I am missing.

Individuals with this issue can try MR460 from the Gin/Gutenberg issue to see the fix and I'm proposing the update from above for Gin to review.

πŸ› Bug report
Status

Fixed

Version

2.1

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States pbabin

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024