Problem/Motivation

Receiving a JavaScript error in console: Uncaught TypeError: Drupal.registerLpbMoveError is not a function
at move_errors.js

I'm on drupal 10.4
Layout Paragraphs 2.1.1
Mercury Editor 2.2.0-beta5
Layout Paragraphs Limit 1.0.1

I'm assuming it has to do with layout paragraphs 2.1.1 which is a requirement of mercury editor.

Comments

sbubaron created an issue. See original summary.

sbubaron’s picture

Full disclosure, I don't really know what I'm doing, but I based these changes off of layout_paragraphs_permissions disable-reorder.js which similarly defines a call to registerLpbMoveError by adding a behavior attachment. The world of drupal javascript and behaviors is quite foreign to me.

this seems to have fixed the console error and is still preventing the movement of paragraphs based on the limit settings.

I don't create patches often so apologies if I messed up the process.

nagy.balint’s picture

Thanks for the report!

I unfortunately could not reproduce it just with layout paragraphs and layout paragraphs limit.

Maybe the issue only appears in Mercury editor.

I think the issue is with the behavior is that technically the behaviors might be called multiple time, and so this registration can happen several times on a page.
So maybe we need to combine this with "once" on the body tag of the page, to make sure that no matter what, this registration only happens once.

nagy.balint’s picture

Status: Active » Needs review
StatusFileSize
new2.72 KB

Here is a patch with the "once".

  • nagy.balint committed c3b0232a on 1.0.x
    Issue #3496279 by sbubaron, nagy.balint: move_errors.js issue in Mercury...
nagy.balint’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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