1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-24 15:49:44 +02:00

Improve modality mixin with better $ event usage

This commit is contained in:
sauls8t 2018-06-04 14:38:52 +01:00
parent 06b28991a7
commit 193d6914d6

View file

@ -27,7 +27,7 @@ export default Mixin.create({
},
modalInputFocus(modalId, inputId) {
$(modalId).on('shown.bs.modal', function(event) { // eslint-disable-line no-unused-vars
$(modalId).one('shown.bs.modal', function(event) { // eslint-disable-line no-unused-vars
$(inputId).trigger('focus');
});
},
@ -55,7 +55,7 @@ export default Mixin.create({
// If caused by a click, the clicked element is available as the relatedTarget
// property of the event.
modalOnShow(modalId, callback) {
$(modalId).on('show.bs.modal', function(e) {
$(modalId).one('show.bs.modal', function(e) {
callback(e);
});
},
@ -64,14 +64,14 @@ export default Mixin.create({
// (will wait for CSS transitions to complete). If caused by a click,
// the clicked element is available as the relatedTarget property of the event.
modalOnShown(modalId, callback) {
$(modalId).on('shown.bs.modal', function(e) {
$(modalId).one('shown.bs.modal', function(e) {
callback(e);
});
},
// This event is fired immediately when the hide instance method has been called.
modalOnHide(modalId, callback) {
$(modalId).on('hide.bs.modal', function(e) {
$(modalId).one('hide.bs.modal', function(e) {
callback(e);
});
},
@ -79,7 +79,7 @@ export default Mixin.create({
// This event is fired when the modal has finished being hidden from the user
// (will wait for CSS transitions to complete).
modalOnHidden(modalId, callback) {
$(modalId).on('hidden.bs.modal', function(e) {
$(modalId).one('hidden.bs.modal', function(e) {
callback(e);
});
}