diff --git a/cms/static/js/views/pages/container.js b/cms/static/js/views/pages/container.js index f015d1bc14c3..a9f537ea27c4 100644 --- a/cms/static/js/views/pages/container.js +++ b/cms/static/js/views/pages/container.js @@ -385,7 +385,6 @@ function($, _, Backbone, gettext, BasePage, editXBlock: function(event, options) { event.preventDefault(); - console.log('=================================== EDIT ===============================================', event.currentTarget.className); try { if (this.options.isIframeEmbed && event.currentTarget.className === 'access-button') { return window.parent.postMessage( @@ -414,7 +413,23 @@ function($, _, Backbone, gettext, BasePage, || (useNewVideoEditor === 'True' && blockType === 'video') || (useNewProblemEditor === 'True' && blockType === 'problem') ) { - var destinationUrl = primaryHeader.attr('authoring_MFE_base_url') + '/' + blockType + '/' + encodeURI(primaryHeader.attr('data-usage-id')); + var pathToNewXBlockEditor = `/${blockType}/${encodeURI(primaryHeader.attr('data-usage-id'))}`; + var destinationUrl = `${primaryHeader.attr('authoring_MFE_base_url')}${pathToNewXBlockEditor}`; + + try { + if (this.options.isIframeEmbed) { + return window.parent.postMessage( + { + type: 'newXBlockEditor', + payload: { + url: pathToNewXBlockEditor, + } + }, document.referrer + ); + } + } catch (e) { + console.error(e); + } window.location.href = destinationUrl; return; } @@ -564,7 +579,6 @@ function($, _, Backbone, gettext, BasePage, duplicateXBlock: function(event) { event.preventDefault(); - console.log('=========================== duplicateXBlock ============================='); try { if (this.options.isIframeEmbed) { return window.parent.postMessage(