Merge branch 'MDL-70352-MOODLE_310_STABLE' of https://github.com/dmitriim/moodle into MOODLE_310_STABLE

This commit is contained in:
Sara Arjona
2021-01-11 12:24:05 +01:00
6 changed files with 17 additions and 7 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,2 +1,2 @@
define ("core/modal_backdrop",["jquery","core/templates","core/notification","core/fullscreen"],function(a,b,c,d){var e={ROOT:"[data-region=\"modal-backdrop\"]"},f=function(b){this.root=a(b);this.isAttached=!1;if(!this.root.is(e.ROOT)){c.exception({message:"Element is not a modal backdrop"})}};f.prototype.getRoot=function(){return this.root};f.prototype.getAttachmentPoint=function(){return a(d.getElement()||document.body)};f.prototype.attachToDOM=function(){this.getAttachmentPoint().append(this.root);if(this.isAttached){return}this.isAttached=!0};f.prototype.setZIndex=function(a){this.root.css("z-index",a)};f.prototype.isVisible=function(){return this.root.hasClass("show")};f.prototype.hasTransitions=function(){return this.getRoot().hasClass("fade")};f.prototype.show=function(){if(this.isVisible()){return}this.attachToDOM();this.root.removeClass("hide").addClass("show")};f.prototype.hide=function(){if(!this.isVisible()){return}if(this.hasTransitions()){this.getRoot().one("transitionend webkitTransitionEnd oTransitionEnd",function(){this.getRoot().removeClass("show").addClass("hide")}.bind(this))}else{this.getRoot().removeClass("show").addClass("hide")}if(a(document.body).find(this.getRoot()).length){a(document.body).append(this.getRoot())}};f.prototype.destroy=function(){this.root.remove()};return f});
define ("core/modal_backdrop",["jquery","core/templates","core/notification","core/fullscreen"],function(a,b,c,d){var e={ROOT:"[data-region=\"modal-backdrop\"]"},f=function(b){this.root=a(b);this.isAttached=!1;this.attachmentPoint=document.createElement("div");document.body.append(this.attachmentPoint);if(!this.root.is(e.ROOT)){c.exception({message:"Element is not a modal backdrop"})}};f.prototype.getRoot=function(){return this.root};f.prototype.getAttachmentPoint=function(){return a(d.getElement()||this.attachmentPoint)};f.prototype.attachToDOM=function(){this.getAttachmentPoint().append(this.root);if(this.isAttached){return}this.isAttached=!0};f.prototype.setZIndex=function(a){this.root.css("z-index",a)};f.prototype.isVisible=function(){return this.root.hasClass("show")};f.prototype.hasTransitions=function(){return this.getRoot().hasClass("fade")};f.prototype.show=function(){if(this.isVisible()){return}this.attachToDOM();this.root.removeClass("hide").addClass("show")};f.prototype.hide=function(){if(!this.isVisible()){return}if(this.hasTransitions()){this.getRoot().one("transitionend webkitTransitionEnd oTransitionEnd",function(){this.getRoot().removeClass("show").addClass("hide")}.bind(this))}else{this.getRoot().removeClass("show").addClass("hide")}if(a(document.body).find(this.getRoot()).length){a(document.body).append(this.getRoot())}};f.prototype.destroy=function(){this.root.remove();this.attachmentPoint.remove()};return f});
//# sourceMappingURL=modal_backdrop.min.js.map
File diff suppressed because one or more lines are too long
+9 -2
View File
@@ -102,6 +102,8 @@ define([
this.bodyJS = null;
this.footerJS = null;
this.modalCount = modalCounter++;
this.attachmentPoint = document.createElement('div');
document.body.append(this.attachmentPoint);
if (!this.root.is(SELECTORS.CONTAINER)) {
Notification.exception({message: 'Element is not a modal container'});
@@ -648,7 +650,7 @@ define([
* @returns {jQuery}
*/
Modal.prototype.getAttachmentPoint = function() {
return $(Fullscreen.getElement() || document.body);
return $(Fullscreen.getElement() || this.attachmentPoint);
};
/**
@@ -753,6 +755,7 @@ define([
this.hide();
this.root.remove();
this.root.trigger(ModalEvents.destroyed, this);
this.attachmentPoint.remove();
};
/**
@@ -797,7 +800,11 @@ define([
}
if (e.keyCode == KeyCodes.escape) {
this.hide();
if (this.removeOnClose) {
this.destroy();
} else {
this.hide();
}
}
}.bind(this));
+4 -1
View File
@@ -37,6 +37,8 @@ define(['jquery', 'core/templates', 'core/notification', 'core/fullscreen'],
var ModalBackdrop = function(root) {
this.root = $(root);
this.isAttached = false;
this.attachmentPoint = document.createElement('div');
document.body.append(this.attachmentPoint);
if (!this.root.is(SELECTORS.ROOT)) {
Notification.exception({message: 'Element is not a modal backdrop'});
@@ -59,7 +61,7 @@ define(['jquery', 'core/templates', 'core/notification', 'core/fullscreen'],
* @returns {jQuery}
*/
ModalBackdrop.prototype.getAttachmentPoint = function() {
return $(Fullscreen.getElement() || document.body);
return $(Fullscreen.getElement() || this.attachmentPoint);
};
/**
@@ -155,6 +157,7 @@ define(['jquery', 'core/templates', 'core/notification', 'core/fullscreen'],
*/
ModalBackdrop.prototype.destroy = function() {
this.root.remove();
this.attachmentPoint.remove();
};
return ModalBackdrop;