From 32778ff9e18b084aa771e40639020e944e6ed36c Mon Sep 17 00:00:00 2001 From: Krissy Hiserote Date: Wed, 12 Jan 2022 09:42:36 -0600 Subject: [PATCH] AC-2087: Console error on TinyMCE5 : TypeError: Cannot read properties of undefined (reading 'text') --- .../adminhtml/web/js/grid/columns/image/insertImageAction.js | 2 +- lib/web/mage/adminhtml/browser.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/grid/columns/image/insertImageAction.js b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/grid/columns/image/insertImageAction.js index 0b5e9f7b3278e..e30e46327365c 100644 --- a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/grid/columns/image/insertImageAction.js +++ b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/grid/columns/image/insertImageAction.js @@ -49,7 +49,7 @@ define([ showLoader: true }).done($.proxy(function (data) { if (typeof targetElement === 'function') { - targetElement(data.content); + targetElement(data.content, {text: record['title']}); } else if (targetElement.is('textarea')) { this.insertAtCursor(targetElement.get(0), data.content); targetElement.focus(); diff --git a/lib/web/mage/adminhtml/browser.js b/lib/web/mage/adminhtml/browser.js index 148fc25f30dd0..6ebd035998b2d 100644 --- a/lib/web/mage/adminhtml/browser.js +++ b/lib/web/mage/adminhtml/browser.js @@ -307,7 +307,7 @@ define([ showLoader: true }).done($.proxy(function (data) { if (typeof targetEl === 'function') { - targetEl(data); + targetEl(data, {text: fileRow.find('img').attr('alt')}); } else if (targetEl.is('textarea')) { this.insertAtCursor(targetEl.get(0), data); } else {