Skip to content

Commit

Permalink
fix resize ora mfe (#2127)
Browse files Browse the repository at this point in the history
* chore: update resize to work for collapsible

* chore: log error for when ora mfe url isn't defined

* chore: static build

* chore: version bump

* chore: update linting and typo

* chore:  make static
  • Loading branch information
leangseu-edx authored Nov 29, 2023
1 parent 6dcdc3c commit 3e4066d
Show file tree
Hide file tree
Showing 14 changed files with 40 additions and 31 deletions.
2 changes: 1 addition & 1 deletion openassessment/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Initialization Information for Open Assessment Module
"""

__version__ = '6.0.8'
__version__ = '6.0.9'
8 changes: 4 additions & 4 deletions openassessment/xblock/static/dist/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"openassessment-editor-textarea.js.map": "/openassessment-editor-textarea.b8f866ba96a1d2ad92a4.js.map",
"openassessment-editor-tinymce.js": "/openassessment-editor-tinymce.2cc0cab55c3be729265e.js",
"openassessment-editor-tinymce.js.map": "/openassessment-editor-tinymce.2cc0cab55c3be729265e.js.map",
"openassessment-lms.css": "/openassessment-lms.f4cf2dc4a6bd64c339d3.css",
"openassessment-lms.js": "/openassessment-lms.f4cf2dc4a6bd64c339d3.js",
"openassessment-lms.css.map": "/openassessment-lms.f4cf2dc4a6bd64c339d3.css.map",
"openassessment-lms.js.map": "/openassessment-lms.f4cf2dc4a6bd64c339d3.js.map",
"openassessment-lms.css": "/openassessment-lms.1590835662418029291d.css",
"openassessment-lms.js": "/openassessment-lms.1590835662418029291d.js",
"openassessment-lms.css.map": "/openassessment-lms.1590835662418029291d.css.map",
"openassessment-lms.js.map": "/openassessment-lms.1590835662418029291d.js.map",
"openassessment-ltr.css": "/openassessment-ltr.5e4380a9281df732ca84.css",
"openassessment-ltr.js": "/openassessment-ltr.5e4380a9281df732ca84.js",
"openassessment-ltr.css.map": "/openassessment-ltr.5e4380a9281df732ca84.css.map",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
/******/
/******/ var hotApplyOnUpdate = true;
/******/ // eslint-disable-next-line no-unused-vars
/******/ var hotCurrentHash = "7c5fa44084cb9c1b2b1e";
/******/ var hotCurrentHash = "a843aa693a8a6fe52654";
/******/ var hotRequestTimeout = 10000;
/******/ var hotCurrentModuleData = {};
/******/ var hotCurrentChildModule;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
/******/
/******/ var hotApplyOnUpdate = true;
/******/ // eslint-disable-next-line no-unused-vars
/******/ var hotCurrentHash = "7c5fa44084cb9c1b2b1e";
/******/ var hotCurrentHash = "a843aa693a8a6fe52654";
/******/ var hotRequestTimeout = 10000;
/******/ var hotCurrentModuleData = {};
/******/ var hotCurrentChildModule;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

This file was deleted.

4 changes: 2 additions & 2 deletions openassessment/xblock/static/dist/openassessment-lms.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion openassessment/xblock/static/dist/openassessment-ltr.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
/******/
/******/ var hotApplyOnUpdate = true;
/******/ // eslint-disable-next-line no-unused-vars
/******/ var hotCurrentHash = "7c5fa44084cb9c1b2b1e";
/******/ var hotCurrentHash = "a843aa693a8a6fe52654";
/******/ var hotRequestTimeout = 10000;
/******/ var hotCurrentModuleData = {};
/******/ var hotCurrentChildModule;
Expand Down
2 changes: 1 addition & 1 deletion openassessment/xblock/static/dist/openassessment-rtl.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
/******/
/******/ var hotApplyOnUpdate = true;
/******/ // eslint-disable-next-line no-unused-vars
/******/ var hotCurrentHash = "7c5fa44084cb9c1b2b1e";
/******/ var hotCurrentHash = "a843aa693a8a6fe52654";
/******/ var hotRequestTimeout = 10000;
/******/ var hotCurrentModuleData = {};
/******/ var hotCurrentChildModule;
Expand Down
2 changes: 1 addition & 1 deletion openassessment/xblock/static/dist/openassessment-studio.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions openassessment/xblock/static/js/src/lms/oa_base.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ export class BaseView {
const { ORA_MICROFRONTEND_URL, MFE_VIEW_ENABLED } = data.CONTEXT || {};

this.ORA_MICROFRONTEND_URL = ORA_MICROFRONTEND_URL;
if (!this.ORA_MICROFRONTEND_URL && MFE_VIEW_ENABLED) {
// eslint-disable-next-line no-console
console.error('ORA_MICROFRONTEND_URL is not defined. ORA MFE will not be loaded.');
}
this.show_mfe_views = ORA_MICROFRONTEND_URL && MFE_VIEW_ENABLED && !window.navigator.userAgent.includes('org.edx.mobile');

const oraMfeView = $('#ora-mfe-view', this.element);
Expand Down Expand Up @@ -292,12 +296,17 @@ export class BaseView {
if (event.data.type === 'plugin.resize') {
const { height } = event.data.payload;
oraMfeIframe[0].style.height = `${height}px`;
// can't propagate to learning mfe with this height because of extra element in between
window.parent.postMessage({
type: 'plugin.resize',
payload: {
height: document.body.scrollHeight,
},
}, document.referrer);
} else if (event.data.type === 'plugin.modal-close') {
// Forward this event from learning MFE to child
oraMfeIframe[0].contentWindow.postMessage(event.data, '*');
}
// Forward these 2 events back up to learning mfe from child
if (window.parent.length > 0 && ['plugin.modal', 'plugin.resize'].includes(event.data.type)) {
} else if (event.data.type === 'plugin.modal' && window.parent.length > 0) {
window.parent.postMessage(event.data, document.referrer);
}
});
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "edx-ora2",
"version": "6.0.8",
"version": "6.0.9",
"repository": "https://github.com/openedx/edx-ora2.git",
"dependencies": {
"@edx/frontend-build": "^6.1.1",
Expand Down

0 comments on commit 3e4066d

Please sign in to comment.