Commit b29dee80 by Jonathan Piacenti

Fix JS handling of feedback popups.

parent fb9fde32
......@@ -164,28 +164,23 @@ function DragAndDropBlock(runtime, element, configuration) {
* Update the DOM to reflect 'state'.
*/
var applyState = function() {
// Is there a change to the feedback popup?
if (state.feedback !== previousFeedback) {
if (state.feedback) {
// Has the feedback popup been closed?
if (state.closing) {
if (previousFeedback) {
publishEvent({
event_type: 'xblock.drag-and-drop-v2.feedback.closed',
content: previousFeedback,
manually: false,
manually: state.manually_closed,
});
previousFeedback = undefined;
}
}
// Has feedback been set?
if (state.feedback) {
publishEvent({
event_type: 'xblock.drag-and-drop-v2.feedback.opened',
content: state.feedback,
});
} else {
publishEvent({
event_type: 'xblock.drag-and-drop-v2.feedback.closed',
content: state.feedback,
manually: true,
});
}
previousFeedback = state.feedback;
}
updateDOM();
......@@ -475,6 +470,14 @@ function DragAndDropBlock(runtime, element, configuration) {
return;
}
state.closing = true;
if (target.is(close_button)) {
state.manually_closed = true;
previousFeedback = state.feedback;
} else {
state.manually_closed = false;
}
delete state.feedback;
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