The modal js file causes errors that break functionality with paragraphs

Created on 7 December 2023, 10 months ago

Problem/Solution

There are errors caused by the "entity_browser.modal.js" that appear on both node fields & paragraph fields, but seem to only affect paragraph fields on a node form. When attempting to select an image from the entity browser modal on an image field in the paragraph, the modal closes & nothing happens on the image field. It's as if no image was selected at all.

This error is caused by "callback = callback.split('.');" on line 31:

I fixed this line with "callback = (callback + '').split('.');" which led to the second error caused by "fn = fn[callback[j]];" on line 35:

It seems that it cannot always be guaranteed that the value of "callback = (callback + '').split('.')" is a valid function name on "window". In my particular case I was getting "['function(){this', 'length=0}']" as the array value of "callback". To get past this I had to add a check like this:

          for (var j = 0; j < callback.length; j++) {
            if (fn[callback[j]]) {
              fn = fn[callback[j]];
            }
          }

With these two small changes, the errors are gone & images I select in the entity browser modal are now being applied to the image field.

πŸ› Bug report
Status

Active

Version

2.9

Component

Miscellaneous

Created by

πŸ‡ΊπŸ‡ΈUnited States mcannon Philadelphia, PA

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

Comments & Activities

Production build 0.71.5 2024