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:
Sven Marnach
2016-02-04 23:31:38 +01:00
parent 9fd6bef39f
commit 982c3e623b
6 changed files with 14 additions and 13 deletions

View File

@@ -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

View File

@@ -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], {

View File

@@ -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).

View File

@@ -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');