When having the latest Wysiwyg + CKEditor + Media modules installed, and clicking on the insert media button in CKEditor, it does a request to the page http://localhost/media/browser

which loads the jquery.slicknav.js file before the adminimal_admin_menu.js file is loaded, which leads to the following error:
Uncaught TypeError: Cannot read property 'behaviors' of undefined
when trying to assign to Drupal.admin.behaviors.responsivemenu.

Comments

alcroito’s picture

Status: Active » Needs review
StatusFileSize
new1.31 KB

Attaching patch that fixes the issue for me, by first defining the object property if it doesn't exist.

Status: Needs review » Needs work

The last submitted patch, 1: uncaught_typeerror_when-2407007-1.patch, failed testing.

das-peter’s picture

Version: 7.x-1.5 » 7.x-1.x-dev
Status: Needs work » Needs review
StatusFileSize
new1.02 KB
new14.21 KB

Just came across the same issue. Attached patch adds Drupal.admin.* predefinitions everywhere used.
Two patches because one also cleans the whitespaces at EOL.

nlambert’s picture

Status: Needs review » Reviewed & tested by the community

solved the problem for me

hydra’s picture

Can confirm that this solves the issue.

juliakoelsch’s picture

When javascript aggregation is enabled, this error prevented the user's ability to insert media into the WYSIWYG editor -- the modal dialog would fail to open entirely.

The patches also fix the issue for us, and allows us to turn javascript aggregation back on.

joelstein’s picture

The patch in #3 fixes this issue nicely for me. Thanks!

proteo’s picture

The patch in #3 also fixes the warning message "drupal.admin is undefined" in the media browser, thanks!

I thinks it's RTBC?

kyletaylored’s picture

Works for me. +1

vancec’s picture

Confirmed #3 fixes it.

mrtndlmt’s picture

Thank you, patch on comment #3 works for me!

lunk rat’s picture

#3 resolved the error, thank you. Please commit.

lmeurs’s picture

Status: Reviewed & tested by the community » Needs work

Though the patch prevent the JS warnings, it is not fixing the problem.

The problem is that object Drupal.admin is defined by the Admin Menu module in admin_menu.js which is not loaded in the Media browser iframe. Since this JS is not loaded, the attached behaviors to Drupal.admin (which is a custom behavior implementation) will never be fired. In my opinion the Adminimal Admin Menu's JS should not be loaded at all in the iframe.

Admin Menu attaches the JS using a rather specific $page['page_bottom']['admin_menu']['#attached'], while Adminimal Admin Menu uses drupal_add_js().

jimmyko’s picture

@lmeurs I have just suggested to use #attached before seeing your reply here.

matthiasm11’s picture

Status: Needs work » Needs review
StatusFileSize
new4.7 KB

Changed drupal_add_js and drupal_add_css to ['#attached'].
Increased the module weight, so adminimal_admin_menu runs after admin_menu.

Status: Needs review » Needs work

The last submitted patch, 16: adminimal_admin_menu-js-error-2407007-16.patch, failed testing.

idebr’s picture

Status: Needs work » Needs review
jollysolutions’s picture

Status: Needs review » Reviewed & tested by the community
mikeytown2’s picture

Messing with the weights is a little fragile. Fixing the JS is the better option.

jatorresdev’s picture

#20 work for me

donaldinou’s picture

agreed with #20.


but this will not correctly solve the issue because for now the admin_menu does not appear on my front website.

Please take also care about https://www.drupal.org/node/2902776

mikeytown2’s picture

Patch that includes white space fixes

philsward’s picture

Patch #24 fixed an issue I was having where the menu was not showing up when advagg was enabled and set to responsive. Came from #2907586: Adminimal Administration Menu breaks display for Deferred JavaScript Execution option

NerOcrO’s picture

#24 is good for me, thx :)

tessa bakker’s picture

Status: Reviewed & tested by the community » Fixed

Applied patch #1 , although patch #16 could be a great addition in a separate issue.

tessa bakker’s picture

Status: Fixed » Closed (fixed)
joelpittet’s picture

Just a heads up, you may know this but the “fixed” status auto-closes after 2 weeks. And shows some of the recent changes, helpful for tracking down regressions.