Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2882,6 +2882,7 @@ def _should_send_learning_badge_events(settings):
'openassessment',
'conditional',
'done',
'edx_sga',
'freetextresponse',
'google-calendar',
'google-document',
Expand Down
26 changes: 23 additions & 3 deletions common/templates/xblock_v2/xblock_iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,18 @@
// The minimal RequireJS configuration required for common LMS and CMS building XBlock types to work:
require = require || RequireJS.require;
define = define || RequireJS.define;
baseUrl = "";
(function (require, define) {
if ('{{ view_name | safe }}' === 'studio_view') {
// Call `require-config.js` of the CMS
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = "{{ cms_root_url }}/static/studio/cms/js/require-config.js";
document.head.appendChild(script);
baseUrl = "{{ cms_root_url }}/static/studio";

require.config({
baseUrl: "{{ cms_root_url }}/static/studio",
baseUrl,
paths: {
accessibility: 'js/src/accessibility_tools',
draggabilly: 'js/vendor/draggabilly',
Expand All @@ -64,8 +66,9 @@
"{{ lms_root_url }}/static/dist{{ oa_manifest.oa_editor_textarea_js }}",
]);
} else {
baseUrl = "{{ lms_root_url }}/static/";
require.config({
baseUrl: "{{ lms_root_url }}/static/",
baseUrl,
paths: {
accessibility: 'js/src/accessibility_tools',
draggabilly: 'js/vendor/draggabilly',
Expand Down Expand Up @@ -375,7 +378,6 @@
if ('{{ view_name | safe }}' === 'studio_view') {
// Used when rendering the `studio_view`, in order to avoid open a new tab on click cancel or save
const selectors = [
'.cancel-button',
'.save-button',
'.action-cancel',
'.action-save',
Expand All @@ -391,6 +393,24 @@
});
}
}

// This button is used in `StudioEditableXBlockMixin` from the `Xblock` app
// That app adds a listener that removes any TinyMCE editors on click cancel.
// ref: https://github.com/openedx/XBlock/blob/86eee4b05dffa42b009fab2a9050b73766131b9d/xblock/utils/public/studio_edit.js#L169
//
// Here that is an issue because we show a confirmation modal when clicking cancel,
// if the user stays to edit all TinyMCE editors are no longer there.
//
// We uncouple the listener to avoid remove the TinyMCE editors
const extraCancelSelector = '.cancel-button';
const elements = $(extraCancelSelector).first();
if (elements.length) {
elements.first().unbind("click");
elements.on('click', function() {
event.preventDefault();
runtime.notify('cancel', {});
});
}
}
}

Expand Down