Skip to content

Commit

Permalink
feat: post msg for new editor
Browse files Browse the repository at this point in the history
  • Loading branch information
PKulkoRaccoonGang committed Oct 24, 2024
1 parent 619724b commit e921480
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions cms/static/js/views/pages/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit e921480

Please sign in to comment.