Skip to content

Commit

Permalink
feat: open new editors from non-unit Studio container page (#33575)
Browse files Browse the repository at this point in the history
Make the edit button on a container page for a non-unit block
(i.e. an individual text, problem or video block) open the new
editor when the relevant flag is enabled.
  • Loading branch information
ArturGaspar authored May 31, 2024
1 parent 9c6f337 commit 90fc5f8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cms/static/js/views/pages/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ function($, _, Backbone, gettext, BasePage,
event.preventDefault();

if (!options || options.view !== 'visibility_view') {
const primaryHeader = $(event.target).closest('.xblock-header-primary');
const primaryHeader = $(event.target).closest('.xblock-header-primary, .nav-actions');

var useNewTextEditor = primaryHeader.attr('use-new-editor-text'),
useNewVideoEditor = primaryHeader.attr('use-new-editor-video'),
Expand Down
19 changes: 18 additions & 1 deletion cms/templates/container.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
from django.utils.translation import gettext as _

from cms.djangoapps.contentstore.helpers import xblock_studio_url, xblock_type_display_name
from cms.djangoapps.contentstore.toggles import use_new_text_editor, use_new_problem_editor, use_new_video_editor, use_video_gallery_flow
from cms.djangoapps.contentstore.utils import get_editor_page_base_url
from openedx.core.djangolib.js_utils import (
dump_js_escaped_json, js_escaped_string
)
Expand Down Expand Up @@ -111,6 +113,13 @@

<%block name="content">

<%
use_new_editor_text = use_new_text_editor()
use_new_editor_video = use_new_video_editor()
use_new_editor_problem = use_new_problem_editor()
use_new_video_gallery_flow = use_video_gallery_flow()
%>

<script type="text/javascript">
window.STUDIO_FRONTEND_IN_CONTEXT_IMAGE_SELECTION = true;
</script>
Expand Down Expand Up @@ -161,7 +170,15 @@ <h1 class="page-header-title xblock-field-value incontext-editor-value"><span cl
</div>
</div>

<nav class="nav-actions" aria-label="${_('Page Actions')}">
<nav class="nav-actions" aria-label="${_('Page Actions')}"
use-new-editor-text = ${use_new_editor_text}
use-new-editor-video = ${use_new_editor_video}
use-new-editor-problem = ${use_new_editor_problem}
use-video-gallery-flow = ${use_new_video_gallery_flow}
authoring_MFE_base_url = ${get_editor_page_base_url(xblock_locator.course_key)}
data-block-type = ${xblock.scope_ids.block_type}
data-usage-id = ${xblock.scope_ids.usage_id}
>
<h3 class="sr">${_("Page Actions")}</h3>
<ul>
## Hide the sequence navigation when we've browsed into a child of the unit, e.g. showing the child blocks of a problem-builder xblock
Expand Down

0 comments on commit 90fc5f8

Please sign in to comment.