Pass DOM element, not jQuery object to XBlock initialisation.
The function initializeXBlock() expects a DOM element, and is passed one in most cases. However, when adding a new XBlock component in Studio, the function is passed a jQuery object, which ends up being forwarded to the actual initialisation function of the XBlock.
This commit is contained in:
@@ -26,7 +26,7 @@ class @HTMLEditingDescriptor
|
||||
CUSTOM_FONTS + STANDARD_FONTS
|
||||
|
||||
constructor: (element) ->
|
||||
@element = element
|
||||
@element = $(element)
|
||||
@base_asset_url = @element.find("#editor-tab").data('base-asset-url')
|
||||
@editor_choice = @element.find("#editor-tab").data('editor')
|
||||
if @base_asset_url == undefined
|
||||
|
||||
@@ -13,7 +13,7 @@ class @MarkdownEditingDescriptor extends XModule.Descriptor
|
||||
@explanationTemplate: "[explanation]\n#{gettext 'Short explanation'}\n[explanation]\n"
|
||||
|
||||
constructor: (element) ->
|
||||
@element = element
|
||||
@element = $(element)
|
||||
|
||||
if $(".markdown-box", @element).length != 0
|
||||
@markdown_editor = CodeMirror.fromTextArea($(".markdown-box", element)[0], {
|
||||
|
||||
@@ -2,7 +2,7 @@ class @TabsEditingDescriptor
|
||||
@isInactiveClass : "is-inactive"
|
||||
|
||||
constructor: (element) ->
|
||||
@element = element;
|
||||
@element = $(element)
|
||||
###
|
||||
Not tested on syncing of multiple editors of same type in tabs
|
||||
(Like many CodeMirrors).
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
} else {
|
||||
block = {};
|
||||
}
|
||||
block.element = element;
|
||||
block.element = $element;
|
||||
block.name = $element.data('name');
|
||||
block.type = $element.data('block-type');
|
||||
$element.trigger('xblock-initialized');
|
||||
|
||||
Reference in New Issue
Block a user