Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit 3cbe8ff

Browse files
committed
Treat question statement like html
1 parent e5a5e5a commit 3cbe8ff

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

runestone/dragndrop/js/dragndrop.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ export default class DragNDrop extends RunestoneBase {
4444
populate() {
4545
for (var i = 0; i < this.origElem.childNodes.length; i++) {
4646
if (
47-
$(this.origElem.childNodes[i]).data("subcomponent") === "dropzone"
47+
$(this.origElem.childNodes[i]).data("subcomponent") ===
48+
"dropzone"
4849
) {
4950
var tmp = $(this.origElem).find(
5051
`#${$(this.origElem.childNodes[i]).attr("for")}`
@@ -55,21 +56,22 @@ export default class DragNDrop extends RunestoneBase {
5556
$(replaceSpan).attr("draggable", "true");
5657
$(replaceSpan).addClass("draggable-drag");
5758
var otherReplaceSpan = document.createElement("span");
58-
otherReplaceSpan.innerHTML = this.origElem.childNodes[
59-
i
60-
].innerHTML;
59+
otherReplaceSpan.innerHTML =
60+
this.origElem.childNodes[i].innerHTML;
6161
$(otherReplaceSpan).addClass("draggable-drop");
6262
this.setEventListeners(replaceSpan, otherReplaceSpan);
6363
var tmpArr = [];
6464
tmpArr.push(replaceSpan);
6565
tmpArr.push(otherReplaceSpan);
6666
this.dragPairArray.push(tmpArr);
6767
} else if (
68-
$(this.origElem.childNodes[i]).data("subcomponent") === "question"
68+
$(this.origElem.childNodes[i]).data("subcomponent") ===
69+
"question"
6970
) {
7071
this.question = this.origElem.childNodes[i].innerHTML;
7172
} else if (
72-
$(this.origElem.childNodes[i]).data("subcomponent") === "feedback"
73+
$(this.origElem.childNodes[i]).data("subcomponent") ===
74+
"feedback"
7375
) {
7476
this.feedback = this.origElem.childNodes[i].innerHTML;
7577
}
@@ -85,7 +87,7 @@ export default class DragNDrop extends RunestoneBase {
8587
$(this.containerDiv).addClass(
8688
"alert alert-warning draggable-container"
8789
);
88-
$(this.containerDiv).text(this.question);
90+
$(this.containerDiv).html(this.question);
8991
this.containerDiv.appendChild(document.createElement("br"));
9092
this.dragDropWrapDiv = document.createElement("div"); // Holds the draggables/dropzones, prevents feedback from bleeding in
9193
$(this.dragDropWrapDiv).css("display", "block");
@@ -209,7 +211,7 @@ export default class DragNDrop extends RunestoneBase {
209211
if (this.pregnantIndexArray[this.indexArray[i]] !== "-1") {
210212
this.dragPairArray[this.indexArray[i]][1].appendChild(
211213
this.dragPairArray[
212-
this.pregnantIndexArray[this.indexArray[i]]
214+
this.pregnantIndexArray[this.indexArray[i]]
213215
][0]
214216
);
215217
}

0 commit comments

Comments
 (0)