Commit 3b31be05 by Jonathan Piacenti

Fix JS handling of feedback popups.

parent 7a1ddad9
...@@ -160,28 +160,23 @@ function DragAndDropBlock(runtime, element, configuration) { ...@@ -160,28 +160,23 @@ function DragAndDropBlock(runtime, element, configuration) {
* Update the DOM to reflect 'state'. * Update the DOM to reflect 'state'.
*/ */
var applyState = function() { var applyState = function() {
// Is there a change to the feedback popup? // Has the feedback popup been closed?
if (state.feedback !== previousFeedback) { if (state.closing) {
if (state.feedback) {
if (previousFeedback) { if (previousFeedback) {
publishEvent({ publishEvent({
event_type: 'xblock.drag-and-drop-v2.feedback.closed', event_type: 'xblock.drag-and-drop-v2.feedback.closed',
content: previousFeedback, content: previousFeedback,
manually: false, manually: state.manually_closed,
}); });
previousFeedback = undefined;
}
} }
// Has feedback been set?
if (state.feedback) {
publishEvent({ publishEvent({
event_type: 'xblock.drag-and-drop-v2.feedback.opened', event_type: 'xblock.drag-and-drop-v2.feedback.opened',
content: state.feedback, content: state.feedback,
}); });
} else {
publishEvent({
event_type: 'xblock.drag-and-drop-v2.feedback.closed',
content: state.feedback,
manually: true,
});
}
previousFeedback = state.feedback;
} }
updateDOM(); updateDOM();
...@@ -471,6 +466,14 @@ function DragAndDropBlock(runtime, element, configuration) { ...@@ -471,6 +466,14 @@ function DragAndDropBlock(runtime, element, configuration) {
return; return;
} }
state.closing = true;
if (target.is(close_button)) {
state.manually_closed = true;
previousFeedback = state.feedback;
} else {
state.manually_closed = false;
}
delete state.feedback; delete state.feedback;
applyState(); applyState();
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment