diff --git a/cms/static/js/views/pages/container.js b/cms/static/js/views/pages/container.js index 286111e7f0..347f7ea77b 100644 --- a/cms/static/js/views/pages/container.js +++ b/cms/static/js/views/pages/container.js @@ -187,15 +187,15 @@ define(['jquery', 'underscore', 'backbone', 'gettext', 'js/views/pages/base_page event.preventDefault(); if(!options || options.view !== 'visibility_view' ){ - var useNewTextEditor = this.$('.edit-button').attr("use-new-editor-text"), - useNewVideoEditor = this.$('.edit-button').attr("use-new-editor-video"), - useNewProblemEditor = this.$('.edit-button').attr("use-new-editor-problem"), - blockType = xblockElement.find('.xblock').attr("data-block-type"); + var useNewTextEditor = this.$('.xblock-header-primary').attr("use-new-editor-text"), + useNewVideoEditor = this.$('.xblock-header-primary').attr("use-new-editor-video"), + useNewProblemEditor = this.$('.xblock-header-primary').attr("use-new-editor-problem"), + blockType = xblockElement.find('.xblock').attr("data-block-type"); if( (useNewTextEditor === "True" && blockType === "html") || (useNewVideoEditor === "True" && blockType === "video") || (useNewProblemEditor === "True" && blockType === "problem") ) { - var destinationUrl = this.$('.edit-button').attr("authoring_MFE_base_url") + '/' + blockType + '/' + encodeURI(xblockElement.find('.xblock').attr("data-usage-id")); + var destinationUrl = this.$('.xblock-header-primary').attr("authoring_MFE_base_url") + '/' + blockType + '/' + encodeURI(xblockElement.find('.xblock').attr("data-usage-id")); window.location.href = destinationUrl; return; } @@ -322,6 +322,23 @@ define(['jquery', 'underscore', 'backbone', 'gettext', 'js/views/pages/base_page }, onNewXBlock: function(xblockElement, scrollOffset, is_duplicate, data) { + var useNewTextEditor = this.$('.xblock-header-primary').attr("use-new-editor-text"), + useNewVideoEditor = this.$('.xblock-header-primary').attr("use-new-editor-video"), + useNewProblemEditor = this.$('.xblock-header-primary').attr("use-new-editor-problem"); + + //find the block type in the locator if availible + if(data.hasOwnProperty('locator')){ + var matchBlockTypeFromLocator = /\@(.*?)\+/; + var blockType = data.locator.match(matchBlockTypeFromLocator); + } + if((useNewTextEditor === "True" && blockType.includes("html")) || + (useNewVideoEditor === "True" && blockType.includes("video"))|| + (useNewProblemEditor === "True" && blockType.includes("problem")) + ){ + var destinationUrl = this.$('.xblock-header-primary').attr("authoring_MFE_base_url") + '/' + blockType[1] + '/' + encodeURI(data.locator); + window.location.href = destinationUrl; + return; + } ViewUtils.setScrollOffset(xblockElement, scrollOffset); xblockElement.data('locator', data.locator); return this.refreshXBlock(xblockElement, true, is_duplicate); diff --git a/cms/templates/studio_xblock_wrapper.html b/cms/templates/studio_xblock_wrapper.html index 15a2d3a857..2194a5e2f0 100644 --- a/cms/templates/studio_xblock_wrapper.html +++ b/cms/templates/studio_xblock_wrapper.html @@ -59,7 +59,12 @@ block_is_unit = is_unit(xblock) % if not show_preview: is-collapsed % endif - "> + " + use-new-editor-text = ${use_new_editor_text} + use-new-editor-video = ${use_new_editor_video} + use-new-editor-problem = ${use_new_editor_problem} + authoring_MFE_base_url = ${get_editor_page_base_url(xblock.location.course_key)} + >
% if show_inline: @@ -80,12 +85,7 @@ block_is_unit = is_unit(xblock) % if can_edit: % if not show_inline:
  • - diff --git a/common/lib/xmodule/xmodule/templates/html/raw.yaml b/common/lib/xmodule/xmodule/templates/html/raw.yaml index 8d4c78ca89..d844f15403 100644 --- a/common/lib/xmodule/xmodule/templates/html/raw.yaml +++ b/common/lib/xmodule/xmodule/templates/html/raw.yaml @@ -6,7 +6,6 @@ data: |

    This template is similar to the Text template. The only difference is that this template opens in the Raw HTML editor rather than in the Visual editor.

    -

    The Raw HTML editor saves your HTML exactly as you enter it. You can switch to the Visual editor by clicking the Settings tab and changing the Editor setting to Visual. Note, however, that some of your