mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-12 11:45:38 +08:00
fix sticky warning.
Widget.warning('text....') was infinitely sticky in some cases like content manager raising 'not implemented' on copy. The make default click_callback to dismiss notification, and fix the logic to not unbind the click handler if it requests the notification not to be dismissed.
This commit is contained in:
parent
1ca890e16c
commit
7cbc54b9c3
@ -99,19 +99,22 @@ define([
|
||||
}, timeout);
|
||||
}
|
||||
|
||||
// bind the click callback if it is given
|
||||
if (click_callback !== undefined) {
|
||||
this.element.click(function () {
|
||||
if (click_callback() !== false) {
|
||||
that.element.fadeOut(100, function () {that.inner.text('');});
|
||||
}
|
||||
that.element.unbind('click');
|
||||
if (that.timeout !== null) {
|
||||
clearTimeout(that.timeout);
|
||||
that.timeout = null;
|
||||
}
|
||||
});
|
||||
// if no click callback assume we will just dismiss the notification
|
||||
if (click_callback === undefined) {
|
||||
click_callback = function(){return true};
|
||||
}
|
||||
// on click, remove widget if click callback say so
|
||||
// and unbind click event.
|
||||
this.element.click(function () {
|
||||
if (click_callback() !== false) {
|
||||
that.element.fadeOut(100, function () {that.inner.text('');});
|
||||
that.element.unbind('click');
|
||||
}
|
||||
if (that.timeout !== null) {
|
||||
clearTimeout(that.timeout);
|
||||
that.timeout = null;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user