Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: advanced editor styling on library authoring [FC-0076] #36146

1 change: 1 addition & 0 deletions cms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,7 @@

# Public domain name of Studio (should be resolvable from the end-user's browser)
CMS_BASE = 'localhost:18010'
CMS_ROOT_URL = "https://localhost:18010"

LOG_DIR = '/edx/var/log/edx'

Expand Down
1 change: 1 addition & 0 deletions cms/envs/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ def get_env_setting(setting):
CMS_BASE = ENV_TOKENS.get('CMS_BASE')
LMS_BASE = ENV_TOKENS.get('LMS_BASE')
LMS_ROOT_URL = ENV_TOKENS.get('LMS_ROOT_URL')
CMS_ROOT_URL = ENV_TOKENS.get('CMS_ROOT_URL')
LMS_INTERNAL_ROOT_URL = ENV_TOKENS.get('LMS_INTERNAL_ROOT_URL', LMS_ROOT_URL)
ENTERPRISE_API_URL = ENV_TOKENS.get('ENTERPRISE_API_URL', LMS_INTERNAL_ROOT_URL + '/enterprise/api/v1/')
ENTERPRISE_CONSENT_API_URL = ENV_TOKENS.get('ENTERPRISE_CONSENT_API_URL', LMS_INTERNAL_ROOT_URL + '/consent/api/v1/')
Expand Down
3 changes: 3 additions & 0 deletions cms/envs/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@
LMS_ROOT_URL = f"http://{LMS_BASE}"
FEATURES['PREVIEW_LMS_BASE'] = "preview.localhost"

CMS_BASE = "localhost:8001"
CMS_ROOT_URL = f"http://{CMS_BASE}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rpenido I think CMS_ROOT_URL is a new env variable, right? I think we should add it in cms/envs/common.py, in cms/envs/production.py. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure! Done here: f92d488


COURSE_AUTHORING_MICROFRONTEND_URL = "http://course-authoring-mfe"
DISCUSSIONS_MICROFRONTEND_URL = "http://discussions-mfe"

Expand Down
33 changes: 32 additions & 1 deletion cms/static/sass/course-unit-mfe-iframe-bundle.scss
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ body {
}
}

.modal-window.modal-editor {
.modal-window.modal-editor, &.xblock-iframe-content {
background-color: $white;
border-radius: 6px;

Expand Down Expand Up @@ -381,6 +381,37 @@ body {
.modal-lg.modal-window.confirm.openassessment_modal_window {
height: 635px;
}

// Additions for the xblock editor on the Library Authoring
&.xblock-iframe-content {
// Reset the max-height to allow the settings list to grow
.wrapper-comp-settings .list-input.settings-list {
max-height: unset;
}

// For Google Docs and Google Calendar xblock editor
.google-edit-wrapper .xblock-inputs {
position: unset;
overflow-y: unset;
}

.xblock-actions {
padding: ($baseline*0.75) 2% ($baseline/2) 2%;
position: sticky;
bottom: 0;

.action-item {
@extend %t-action3;

display: inline-block;
margin-right: ($baseline*0.75);

&:last-child {
margin-right: 0;
}
}
}
}
}

.view-container .content-primary {
Expand Down
24 changes: 15 additions & 9 deletions common/templates/xblock_v2/xblock_iframe.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!DOCTYPE html>

<html>
<!-- Set the height of the iframe to 100% of the viewport height to avoid an extra scrollbar -->
<html style="height: 100vh;">
<head>
<!-- Open links in a new tab, not this iframe -->
<base target="_blank">
Expand Down Expand Up @@ -81,8 +82,11 @@
href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<!-- Capa Problem Editing requires CodeMirror -->
<link rel="stylesheet" href="{{ lms_root_url }}/static/js/vendor/CodeMirror/codemirror.css">
<!-- Built-in XBlocks (and some plugins) depends on LMS CSS -->
<link rel="stylesheet" href="{{ lms_root_url }}/static/css/lms-course.css">
Comment on lines -84 to -85
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the editor iframe, the lms-course.css caused some issues.

I didn't find where this was used to check the results, but the Unit Outline and the Course View seem okay.

We can't add this conditionally if needed.

<!-- Additional CSS for the XBlock Editor on the Library Authoring -->
<link rel="stylesheet" href="{{ cms_root_url }}/static/studio/css/vendor/normalize.css">
<link rel="stylesheet" href="{{ cms_root_url }}/static/studio/css/studio-main-v1.css" />
<link rel="stylesheet" href="{{ cms_root_url }}/static/studio/css/course-unit-mfe-iframe-bundle.css" />

<!-- Configure and load MathJax -->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
Expand Down Expand Up @@ -156,11 +160,13 @@
<!-- The default stylesheet will set the body min-height to 100% (a common strategy to allow for background
images to fill the viewport), but this has the undesireable side-effect of causing an infinite loop via the onResize
event listeners below, in certain situations. Resetting it to the default "auto" skirts the problem.-->
<body style="min-height: auto; background-color: white;">
<!-- fragment body -->
{{ fragment.body_html | safe }}
<!-- fragment foot -->
{{ fragment.foot_html | safe }}
<body style="min-height: auto; background-color: white;" class="view-container">
<div class="wrapper xblock-iframe-content">
<!-- fragment body -->
{{ fragment.body_html | safe }}
<!-- fragment foot -->
{{ fragment.foot_html | safe }}
</div>
<script>
/**
* Map of all URL handlers for this block and its children, keyed by usage
Expand Down Expand Up @@ -216,7 +222,7 @@
return url;
},
notify: (eventName, data) => {
/**
/**
* Used in `studio_view` to notify events and errors
**/
window.parent.postMessage({
Expand Down
2 changes: 2 additions & 0 deletions openedx/core/djangoapps/xblock/rest_api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,12 @@ def embed_block_view(request, usage_key: UsageKeyV2, view_name: str):
# for key in itertools.chain([block.scope_ids.usage_id], getattr(block, 'children', []))
# }
lms_root_url = configuration_helpers.get_value('LMS_ROOT_URL', settings.LMS_ROOT_URL)
cms_root_url = configuration_helpers.get_value('CMS_ROOT_URL', settings.CMS_ROOT_URL)
rpenido marked this conversation as resolved.
Show resolved Hide resolved
context = {
'fragment': fragment,
'handler_urls_json': json.dumps(handler_urls),
'lms_root_url': lms_root_url,
'cms_root_url': cms_root_url,
'view_name': view_name,
'is_development': settings.DEBUG,
}
Expand Down
Loading