Magento2: JavaScript error: "Cannot read property 'closed'" in Product Edit Page

Created on 24 Jun 2016  路  9Comments  路  Source: magento/magento2

I found problem with window in edit product page from first magento 2 releases, when you opens Wysiwyg editor many times, then something is going wrong with JavaScript object initialization.

In new Magento 2.1 developers disabled window for wysisbvig, but I see still probem for "Insert Image" button.

Steps to reproduce

  1. Update Magento 2.0.7 to Magento 2.1
  2. Go to edit product Page
  3. Click On "Insert Image"
  4. Close Window
  5. Click On "Insert Image" again
  6. In browser console you will see:

Uncaught TypeError: Cannot read property 'closed' of undefined in browser.js 39

And I can't open window for inserting image twice.

Catalog Fixed in 2.1.x Fixed in 2.2.x Fixed in 2.3.x Clear Description Confirmed Format is not valid bug report

Most helpful comment

It also looks like this issue was fixed 4 months ago but it's not been released yet:
https://github.com/magento/magento2/commit/04a020a2e1db9f38378473733d65925b18dbdd15

All 9 comments

Hello Team! It's real priority issue, Wysiwyg does not work correctly on all magento versions.

I can confirm this issue.
Temporary bugfix would be to change the following in lib\web\mage\adminhtml\browser.js

Change
closeDialog: function() { this.modal.modal('closeModal'); }

to
closeDialog: function() { this.modal.modal('closeModal'); this.modal = null; }

But I assume it's not the 'correct' solution to reset the modal parameter on the MediabrowserUtility object so that's why I'm calling this a temp fix :)

@koenner01 , your way is'nt work.
but I've fixed by change (lib\web\mage\adminhtml\browser.js)

            if (this.modal) {
                this.modal.html($(content).html());
                this.modal.modal('option', 'closed', options.closed);
            }

to

            if (this.modal) {
                this.modal.html($(content).html());
                this.modal.modal('option', 'closed', true);
            }

Getting the same issue here but also when using a custom image uploader/chooser in a widget. The above fix of changing the parameter to true works for me but currently I'm just patching the core in my version

It also looks like this issue was fixed 4 months ago but it's not been released yet:
https://github.com/magento/magento2/commit/04a020a2e1db9f38378473733d65925b18dbdd15

@vkorotun Will the fix for this issue be included in 2.1.3?

Same issue here, please could you fix it.

I can report this issue is still present in CE 2.1.4

@Valentyn-Kubrak, thank you for your report.
The issue is already fixed in develop branch, 2.2.0, 2.1.9

Was this page helpful?
0 / 5 - 0 ratings