From 195c37d83c987f65c2798c07dcc1add6a51d1f3e Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Sat, 11 Jan 2025 14:12:29 +0000 Subject: [PATCH] Fixed issue in rearrange JS with Modal not closing (#648) --- amd/build/dialogue.min.js | 2 +- amd/build/dialogue.min.js.map | 2 +- amd/src/dialogue.js | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/amd/build/dialogue.min.js b/amd/build/dialogue.min.js index 772e910e..2eb3b61a 100644 --- a/amd/build/dialogue.min.js +++ b/amd/build/dialogue.min.js @@ -6,6 +6,6 @@ * @copyright 2016 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -define("mod_customcert/dialogue",["core/yui"],(function(Y){var dialogue=function(title,content,afterShow,afterHide,wide){this.yuiDialogue=null;var parent=this;void 0===wide&&(wide=!1),Y.use("moodle-core-notification","timers",(function(){var width="480px";wide&&(width="800px"),parent.yuiDialogue=new M.core.dialogue({headerContent:title,bodyContent:content,draggable:!0,visible:!1,center:!0,modal:!0,width:width}),parent.yuiDialogue.after("visibleChange",(function(e){e.newVal?void 0!==afterShow&&Y.soon((function(){afterShow(parent),parent.yuiDialogue.centerDialogue()})):void 0!==afterHide&&Y.soon((function(){afterHide(parent)}))})),parent.yuiDialogue.show()}))};return dialogue.prototype.close=function(){this.yuiDialogue.hide(),this.yuiDialogue.destroy()},dialogue.prototype.getContent=function(){return this.yuiDialogue.bodyNode.getDOMNode()},dialogue})); +define("mod_customcert/dialogue",["core/yui"],(function(Y){var dialogue=function(title,content,afterShow,afterHide,wide){this.yuiDialogue=null;var parent=this;void 0===wide&&(wide=!1),Y.use("moodle-core-notification","timers",(function(){var width="480px";wide&&(width="800px"),parent.yuiDialogue=new M.core.dialogue({headerContent:title,bodyContent:content,draggable:!0,visible:!1,center:!0,modal:!0,width:width}),parent.yuiDialogue.after("visibleChange",(function(e){e.newVal?void 0!==afterShow&&Y.soon((function(){afterShow(parent),parent.yuiDialogue.centerDialogue()})):void 0!==afterHide&&Y.soon((function(){afterHide(parent),parent.close()}))})),parent.yuiDialogue.show()}))};return dialogue.prototype.close=function(){this.yuiDialogue.hide(),this.yuiDialogue.destroy()},dialogue.prototype.getContent=function(){return this.yuiDialogue.bodyNode.getDOMNode()},dialogue})); //# sourceMappingURL=dialogue.min.js.map \ No newline at end of file diff --git a/amd/build/dialogue.min.js.map b/amd/build/dialogue.min.js.map index 3e73de54..3f1615ee 100644 --- a/amd/build/dialogue.min.js.map +++ b/amd/build/dialogue.min.js.map @@ -1 +1 @@ -{"version":3,"file":"dialogue.min.js","sources":["../src/dialogue.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * Wrapper for the YUI M.core.notification class. Allows us to\n * use the YUI version in AMD code until it is replaced.\n *\n * @module mod_customcert/dialogue\n * @copyright 2016 Mark Nelson \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['core/yui'], function(Y) {\n\n /**\n * Constructor\n *\n * @param {String} title Title for the window.\n * @param {String} content The content for the window.\n * @param {function} afterShow Callback executed after the window is opened.\n * @param {function} afterHide Callback executed after the window is closed.\n * @param {Boolean} wide Specify we want an extra wide dialogue (the size is standard, but wider than the default).\n */\n var dialogue = function(title, content, afterShow, afterHide, wide) {\n this.yuiDialogue = null;\n var parent = this;\n\n // Default for wide is false.\n if (typeof wide == 'undefined') {\n wide = false;\n }\n\n Y.use('moodle-core-notification', 'timers', function() {\n var width = '480px';\n if (wide) {\n width = '800px';\n }\n\n parent.yuiDialogue = new M.core.dialogue({\n headerContent: title,\n bodyContent: content,\n draggable: true,\n visible: false,\n center: true,\n modal: true,\n width: width\n });\n\n parent.yuiDialogue.after('visibleChange', function(e) {\n if (e.newVal) {\n // Delay the callback call to the next tick, otherwise it can happen that it is\n // executed before the dialogue constructor returns.\n if ((typeof afterShow !== 'undefined')) {\n Y.soon(function() {\n afterShow(parent);\n parent.yuiDialogue.centerDialogue();\n });\n }\n } else {\n if ((typeof afterHide !== 'undefined')) {\n Y.soon(function() {\n afterHide(parent);\n });\n }\n }\n });\n\n parent.yuiDialogue.show();\n });\n };\n\n /**\n * Close this window.\n */\n dialogue.prototype.close = function() {\n this.yuiDialogue.hide();\n this.yuiDialogue.destroy();\n };\n\n /**\n * Get content.\n *\n * @returns {HTMLElement}\n */\n dialogue.prototype.getContent = function() {\n return this.yuiDialogue.bodyNode.getDOMNode();\n };\n\n return dialogue;\n});\n"],"names":["define","Y","dialogue","title","content","afterShow","afterHide","wide","yuiDialogue","parent","this","use","width","M","core","headerContent","bodyContent","draggable","visible","center","modal","after","e","newVal","soon","centerDialogue","show","prototype","close","hide","destroy","getContent","bodyNode","getDOMNode"],"mappings":";;;;;;;;AAuBAA,iCAAO,CAAC,aAAa,SAASC,OAWtBC,SAAW,SAASC,MAAOC,QAASC,UAAWC,UAAWC,WACrDC,YAAc,SACfC,OAASC,UAGM,IAARH,OACPA,MAAO,GAGXN,EAAEU,IAAI,2BAA4B,UAAU,eACpCC,MAAQ,QACRL,OACAK,MAAQ,SAGZH,OAAOD,YAAc,IAAIK,EAAEC,KAAKZ,SAAS,CACrCa,cAAeZ,MACfa,YAAaZ,QACba,WAAW,EACXC,SAAS,EACTC,QAAQ,EACRC,OAAO,EACPR,MAAOA,QAGXH,OAAOD,YAAYa,MAAM,iBAAiB,SAASC,GAC3CA,EAAEC,YAGwB,IAAdlB,WACRJ,EAAEuB,MAAK,WACHnB,UAAUI,QACVA,OAAOD,YAAYiB,yBAID,IAAdnB,WACRL,EAAEuB,MAAK,WACHlB,UAAUG,cAM1BA,OAAOD,YAAYkB,kBAO3BxB,SAASyB,UAAUC,MAAQ,gBAClBpB,YAAYqB,YACZrB,YAAYsB,WAQrB5B,SAASyB,UAAUI,WAAa,kBACrBrB,KAAKF,YAAYwB,SAASC,cAG9B/B"} \ No newline at end of file +{"version":3,"file":"dialogue.min.js","sources":["../src/dialogue.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * Wrapper for the YUI M.core.notification class. Allows us to\n * use the YUI version in AMD code until it is replaced.\n *\n * @module mod_customcert/dialogue\n * @copyright 2016 Mark Nelson \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['core/yui'], function(Y) {\n\n /**\n * Constructor\n *\n * @param {String} title Title for the window.\n * @param {String} content The content for the window.\n * @param {function} afterShow Callback executed after the window is opened.\n * @param {function} afterHide Callback executed after the window is closed.\n * @param {Boolean} wide Specify we want an extra wide dialogue (the size is standard, but wider than the default).\n */\n var dialogue = function(title, content, afterShow, afterHide, wide) {\n this.yuiDialogue = null;\n var parent = this;\n\n // Default for wide is false.\n if (typeof wide == 'undefined') {\n wide = false;\n }\n\n Y.use('moodle-core-notification', 'timers', function() {\n var width = '480px';\n if (wide) {\n width = '800px';\n }\n\n parent.yuiDialogue = new M.core.dialogue({\n headerContent: title,\n bodyContent: content,\n draggable: true,\n visible: false,\n center: true,\n modal: true,\n width: width\n });\n\n parent.yuiDialogue.after('visibleChange', function(e) {\n if (e.newVal) {\n // Delay the callback call to the next tick, otherwise it can happen that it is\n // executed before the dialogue constructor returns.\n if ((typeof afterShow !== 'undefined')) {\n Y.soon(function() {\n afterShow(parent);\n parent.yuiDialogue.centerDialogue();\n });\n }\n } else {\n if ((typeof afterHide !== 'undefined')) {\n Y.soon(function() {\n afterHide(parent);\n parent.close();\n });\n }\n }\n });\n\n parent.yuiDialogue.show();\n });\n };\n\n /**\n * Close this window.\n */\n dialogue.prototype.close = function() {\n this.yuiDialogue.hide();\n this.yuiDialogue.destroy();\n };\n\n /**\n * Get content.\n *\n * @returns {HTMLElement}\n */\n dialogue.prototype.getContent = function() {\n return this.yuiDialogue.bodyNode.getDOMNode();\n };\n\n return dialogue;\n});\n"],"names":["define","Y","dialogue","title","content","afterShow","afterHide","wide","yuiDialogue","parent","this","use","width","M","core","headerContent","bodyContent","draggable","visible","center","modal","after","e","newVal","soon","centerDialogue","close","show","prototype","hide","destroy","getContent","bodyNode","getDOMNode"],"mappings":";;;;;;;;AAuBAA,iCAAO,CAAC,aAAa,SAASC,OAWtBC,SAAW,SAASC,MAAOC,QAASC,UAAWC,UAAWC,WACrDC,YAAc,SACfC,OAASC,UAGM,IAARH,OACPA,MAAO,GAGXN,EAAEU,IAAI,2BAA4B,UAAU,eACpCC,MAAQ,QACRL,OACAK,MAAQ,SAGZH,OAAOD,YAAc,IAAIK,EAAEC,KAAKZ,SAAS,CACrCa,cAAeZ,MACfa,YAAaZ,QACba,WAAW,EACXC,SAAS,EACTC,QAAQ,EACRC,OAAO,EACPR,MAAOA,QAGXH,OAAOD,YAAYa,MAAM,iBAAiB,SAASC,GAC3CA,EAAEC,YAGwB,IAAdlB,WACRJ,EAAEuB,MAAK,WACHnB,UAAUI,QACVA,OAAOD,YAAYiB,yBAID,IAAdnB,WACRL,EAAEuB,MAAK,WACHlB,UAAUG,QACVA,OAAOiB,cAMvBjB,OAAOD,YAAYmB,kBAO3BzB,SAAS0B,UAAUF,MAAQ,gBAClBlB,YAAYqB,YACZrB,YAAYsB,WAQrB5B,SAAS0B,UAAUG,WAAa,kBACrBrB,KAAKF,YAAYwB,SAASC,cAG9B/B"} \ No newline at end of file diff --git a/amd/src/dialogue.js b/amd/src/dialogue.js index 6bb93477..2bf858c0 100644 --- a/amd/src/dialogue.js +++ b/amd/src/dialogue.js @@ -71,6 +71,7 @@ define(['core/yui'], function(Y) { if ((typeof afterHide !== 'undefined')) { Y.soon(function() { afterHide(parent); + parent.close(); }); } }