MDL-78306 core: Provide helper method to register modals classes

This commit is contained in:
Andrew Nicols 2023-05-18 14:19:46 +08:00
parent fcb6fdf393
commit 77b4d0236f
No known key found for this signature in database
GPG Key ID: 6D1E3157C8CFBF14
51 changed files with 162 additions and 216 deletions

View File

@ -1,10 +1,3 @@
define("core/local/modal/alert",["exports","core/modal"],(function(_exports,_modal){var obj;
/**
* Alert modal.
*
* @module core/local/modal/alert
* @copyright 2020 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_modal=(obj=_modal)&&obj.__esModule?obj:{default:obj};class _default extends _modal.default{registerEventListeners(){super.registerEventListeners(),this.registerCloseOnCancel()}}return _exports.default=_default,_exports.default}));
define("core/local/modal/alert",["exports","core/modal"],(function(_exports,_modal){var obj;function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_modal=(obj=_modal)&&obj.__esModule?obj:{default:obj};class ModalAlert extends _modal.default{registerEventListeners(){super.registerEventListeners(),this.registerCloseOnCancel()}}return _exports.default=ModalAlert,_defineProperty(ModalAlert,"TYPE","ALERT"),_defineProperty(ModalAlert,"TEMPLATE","core/local/modal/alert"),ModalAlert.registerModalType(),_exports.default}));
//# sourceMappingURL=alert.min.js.map

View File

@ -1 +1 @@
{"version":3,"file":"alert.min.js","sources":["../../../src/local/modal/alert.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 <http://www.gnu.org/licenses/>.\n\n/**\n * Alert modal.\n *\n * @module core/local/modal/alert\n * @copyright 2020 Andrew Nicols <andrew@nicols.co.uk>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Modal from 'core/modal';\n\n/**\n * The Alert Modal\n *\n * @class\n * @extends Modal\n */\nexport default class extends Modal {\n /**\n * Register all event listeners.\n */\n registerEventListeners() {\n // Call the parent registration.\n super.registerEventListeners();\n\n // Register to close on cancel.\n this.registerCloseOnCancel();\n }\n}\n"],"names":["Modal","registerEventListeners","registerCloseOnCancel"],"mappings":";;;;;;;kKA+B6BA,eAIzBC,+BAEUA,8BAGDC"}
{"version":3,"file":"alert.min.js","sources":["../../../src/local/modal/alert.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 <http://www.gnu.org/licenses/>.\n\n/**\n * Alert modal.\n *\n * @module core/local/modal/alert\n * @copyright 2020 Andrew Nicols <andrew@nicols.co.uk>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Modal from 'core/modal';\n\n/**\n * The Alert Modal\n *\n * @class\n * @extends Modal\n */\nexport default class ModalAlert extends Modal {\n static TYPE = 'ALERT';\n static TEMPLATE = 'core/local/modal/alert';\n\n /**\n * Register all event listeners.\n */\n registerEventListeners() {\n // Call the parent registration.\n super.registerEventListeners();\n\n // Register to close on cancel.\n this.registerCloseOnCancel();\n }\n}\n\nModalAlert.registerModalType();\n"],"names":["ModalAlert","Modal","registerEventListeners","registerCloseOnCancel","registerModalType"],"mappings":"4YA+BqBA,mBAAmBC,eAOpCC,+BAEUA,8BAGDC,4EAZQH,kBACH,yBADGA,sBAEC,0BActBA,WAAWI"}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,10 +1,3 @@
define("core/modal_cancel",["exports","core/modal","core/notification"],(function(_exports,_modal,_notification){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}
/**
* Contain the logic for the cancel modal.
*
* @module core/modal_cancel
* @copyright 2016 Ryan Wyllie <ryan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_modal=_interopRequireDefault(_modal),_notification=_interopRequireDefault(_notification);class _default extends _modal.default{constructor(root){super(root),this.getFooter().find(this.getActionSelector("cancel")).length||_notification.default.exception({message:"No cancel button found"})}registerEventListeners(){super.registerEventListeners(),this.registerCloseOnCancel()}}return _exports.default=_default,_exports.default}));
define("core/modal_cancel",["exports","core/modal","core/notification"],(function(_exports,_modal,_notification){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_modal=_interopRequireDefault(_modal),_notification=_interopRequireDefault(_notification);class ModalCancel extends _modal.default{constructor(root){super(root),this.getFooter().find(this.getActionSelector("cancel")).length||_notification.default.exception({message:"No cancel button found"})}registerEventListeners(){super.registerEventListeners(),this.registerCloseOnCancel()}}return _exports.default=ModalCancel,_defineProperty(ModalCancel,"TYPE","CANCEL"),_defineProperty(ModalCancel,"TEMPLATE","core/modal_cancel"),ModalCancel.registerModalType(),_exports.default}));
//# sourceMappingURL=modal_cancel.min.js.map

View File

@ -1 +1 @@
{"version":3,"file":"modal_cancel.min.js","sources":["../src/modal_cancel.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 <http://www.gnu.org/licenses/>.\n\n/**\n * Contain the logic for the cancel modal.\n *\n * @module core/modal_cancel\n * @copyright 2016 Ryan Wyllie <ryan@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Modal from 'core/modal';\nimport Notification from 'core/notification';\n\n/**\n * @class\n * @extends module:core/modal\n */\nexport default class extends Modal {\n constructor(root) {\n super(root);\n\n if (!this.getFooter().find(this.getActionSelector('cancel')).length) {\n Notification.exception({message: 'No cancel button found'});\n }\n }\n\n /**\n * Register all event listeners.\n */\n registerEventListeners() {\n // Call the parent registration.\n super.registerEventListeners();\n\n // Register to close on cancel.\n this.registerCloseOnCancel();\n }\n}\n"],"names":["Modal","constructor","root","this","getFooter","find","getActionSelector","length","exception","message","registerEventListeners","registerCloseOnCancel"],"mappings":";;;;;;;sMA8B6BA,eACzBC,YAAYC,YACFA,MAEDC,KAAKC,YAAYC,KAAKF,KAAKG,kBAAkB,WAAWC,8BAC5CC,UAAU,CAACC,QAAS,2BAOzCC,+BAEUA,8BAGDC"}
{"version":3,"file":"modal_cancel.min.js","sources":["../src/modal_cancel.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 <http://www.gnu.org/licenses/>.\n\n/**\n * Contain the logic for the cancel modal.\n *\n * @module core/modal_cancel\n * @copyright 2016 Ryan Wyllie <ryan@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Modal from 'core/modal';\nimport Notification from 'core/notification';\n\n/**\n * @class\n * @extends module:core/modal\n */\nexport default class ModalCancel extends Modal {\n static TYPE = 'CANCEL';\n static TEMPLATE = 'core/modal_cancel';\n\n constructor(root) {\n super(root);\n\n if (!this.getFooter().find(this.getActionSelector('cancel')).length) {\n Notification.exception({message: 'No cancel button found'});\n }\n }\n\n /**\n * Register all event listeners.\n */\n registerEventListeners() {\n // Call the parent registration.\n super.registerEventListeners();\n\n // Register to close on cancel.\n this.registerCloseOnCancel();\n }\n}\n\nModalCancel.registerModalType();\n"],"names":["ModalCancel","Modal","constructor","root","this","getFooter","find","getActionSelector","length","exception","message","registerEventListeners","registerCloseOnCancel","registerModalType"],"mappings":"uhBA8BqBA,oBAAoBC,eAIrCC,YAAYC,YACFA,MAEDC,KAAKC,YAAYC,KAAKF,KAAKG,kBAAkB,WAAWC,8BAC5CC,UAAU,CAACC,QAAS,2BAOzCC,+BAEUA,8BAGDC,6EApBQZ,mBACH,0BADGA,uBAEC,qBAsBtBA,YAAYa"}

View File

@ -1,3 +1,3 @@
define("core/modal_copy_to_clipboard",["exports","core/modal","core/modal_registry","core/modal_factory","core/copy_to_clipboard"],(function(_exports,_modal,_modal_registry,_modal_factory,_copy_to_clipboard){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_modal=_interopRequireDefault(_modal),_modal_registry=_interopRequireDefault(_modal_registry),_modal_factory=_interopRequireDefault(_modal_factory);class CopyToClipboardModal extends _modal.default{constructor(){super(...arguments),this.setRemoveOnClose(!0)}registerEventListeners(){super.registerEventListeners(...arguments),this.getRoot().get(0).addEventListener("click",(e=>{e.target.closest('[data-action="copytoclipboard"]')&&this.getRoot().get(0).contains(e.target)&&setTimeout(this.destroy.bind(this))}))}static async create(){let{text:text,useTextArea:useTextArea=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},title=arguments.length>1?arguments[1]:void 0;_modal_registry.default.get(this.TYPE)||_modal_registry.default.register(this.TYPE,this,this.TEMPLATE);const modal=await _modal_factory.default.create({type:this.TYPE,templateContext:{text:text,useTextArea:useTextArea}});title&&modal.setTitle(title),modal.show()}}return _exports.default=CopyToClipboardModal,_defineProperty(CopyToClipboardModal,"TYPE","core/copytoclipboard"),_defineProperty(CopyToClipboardModal,"TEMPLATE","core/modal_copytoclipboard"),_exports.default}));
define("core/modal_copy_to_clipboard",["exports","core/modal","core/modal_factory","core/copy_to_clipboard"],(function(_exports,_modal,_modal_factory,_copy_to_clipboard){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_modal=_interopRequireDefault(_modal),_modal_factory=_interopRequireDefault(_modal_factory);class CopyToClipboardModal extends _modal.default{constructor(){super(...arguments),this.setRemoveOnClose(!0)}registerEventListeners(){super.registerEventListeners(...arguments),this.getRoot().get(0).addEventListener("click",(e=>{e.target.closest('[data-action="copytoclipboard"]')&&this.getRoot().get(0).contains(e.target)&&setTimeout(this.destroy.bind(this))}))}static async create(){let{text:text,useTextArea:useTextArea=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},title=arguments.length>1?arguments[1]:void 0;this.registerModalType();const modal=await _modal_factory.default.create({type:this.TYPE,templateContext:{text:text,useTextArea:useTextArea}});title&&modal.setTitle(title),modal.show()}}return _exports.default=CopyToClipboardModal,_defineProperty(CopyToClipboardModal,"TYPE","core/copytoclipboard"),_defineProperty(CopyToClipboardModal,"TEMPLATE","core/modal_copytoclipboard"),_exports.default}));
//# sourceMappingURL=modal_copy_to_clipboard.min.js.map

View File

@ -1 +1 @@
{"version":3,"file":"modal_copy_to_clipboard.min.js","sources":["../src/modal_copy_to_clipboard.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 <http://www.gnu.org/licenses/>.\n\n/**\n * Contain the logic for the copy to clipboard modal, i.e. the modal contains a\n * readonly input text field, that contains a value. Clicking on the single\n * button \"Copy to clipboard\" in the footer, puts the content of the input\n * text field into the clipboard and closes the modal.\n *\n * Usage:\n * ModalCopyToClipboard.create(string:<stringToCopy>, string:<modalTitle>|null);\n *\n * @module core/modal_copy_to_clipboard\n * @copyright 2023 Stephan Robotta <stephan.robotta@bfh.ch>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Modal from 'core/modal';\nimport ModalRegistry from 'core/modal_registry';\nimport ModalFactory from 'core/modal_factory';\nimport 'core/copy_to_clipboard';\n\nexport default class CopyToClipboardModal extends Modal {\n static TYPE = 'core/copytoclipboard';\n static TEMPLATE = 'core/modal_copytoclipboard';\n\n constructor(...config) {\n // Override the constructor to set the removeOnClose property, and show the modal.\n super(...config);\n this.setRemoveOnClose(true);\n }\n\n /**\n * Set up all the event handling for the modal.\n * This is an override of the parent method, adding an event listener to close upon the action.\n *\n * @param {array} args\n */\n registerEventListeners(...args) {\n super.registerEventListeners(...args);\n\n this.getRoot().get(0).addEventListener('click', (e) => {\n if (!e.target.closest('[data-action=\"copytoclipboard\"]')) {\n return;\n }\n\n if (!this.getRoot().get(0).contains(e.target)) {\n return;\n }\n\n // Note: We must call destroy() here, because the copy-to-clipboard action listens on the document,\n // which will be processed after this event listener has been processed.\n // By placing this in a setTimeout we move its processing to after the event loop has finished.\n setTimeout(this.destroy.bind(this));\n });\n }\n\n /**\n * Create a new instance of the Modal. Set the text that is being copied. By default, the text is put into the\n * value of an input readonly field. If useTextArea is set to true, the text is rendered in a textarea element.\n * The optional title argument is for the modal title. If not set, the generic string \"copy to clipboard\" is used.\n *\n * @param {Object} data used in the template\n * @param {string} data.text the text to copy to the clipboard\n * @param {boolean} data.useTextArea when the text to copy is displayed in a textarea, default is input\n * @param {string|null} title\n * @returns {Promise<void>}\n */\n static async create(\n {\n text,\n useTextArea = false,\n } = {},\n title\n ) {\n if (!ModalRegistry.get(this.TYPE)) {\n ModalRegistry.register(this.TYPE, this, this.TEMPLATE);\n }\n\n const modal = await ModalFactory.create({\n type: this.TYPE,\n templateContext: {\n text: text,\n useTextArea: useTextArea,\n },\n });\n if (title) {\n modal.setTitle(title);\n }\n modal.show();\n }\n}"],"names":["CopyToClipboardModal","Modal","constructor","setRemoveOnClose","registerEventListeners","getRoot","get","addEventListener","e","target","closest","this","contains","setTimeout","destroy","bind","text","useTextArea","title","ModalRegistry","TYPE","register","TEMPLATE","modal","ModalFactory","create","type","templateContext","setTitle","show"],"mappings":"grBAkCqBA,6BAA6BC,eAI9CC,uCAGSC,kBAAiB,GAS1BC,+BACUA,0CAEDC,UAAUC,IAAI,GAAGC,iBAAiB,SAAUC,IACxCA,EAAEC,OAAOC,QAAQ,oCAIjBC,KAAKN,UAAUC,IAAI,GAAGM,SAASJ,EAAEC,SAOtCI,WAAWF,KAAKG,QAAQC,KAAKJ,oCAgBjCK,KACIA,KADJC,YAEIA,aAAc,0DACd,GACJC,6CAEKC,wBAAcb,IAAIK,KAAKS,+BACVC,SAASV,KAAKS,KAAMT,KAAMA,KAAKW,gBAG3CC,YAAcC,uBAAaC,OAAO,CACpCC,KAAMf,KAAKS,KACXO,gBAAiB,CACbX,KAAMA,KACNC,YAAaA,eAGjBC,OACAK,MAAMK,SAASV,OAEnBK,MAAMM,qEAnEO7B,4BACH,wCADGA,gCAEC"}
{"version":3,"file":"modal_copy_to_clipboard.min.js","sources":["../src/modal_copy_to_clipboard.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 <http://www.gnu.org/licenses/>.\n\n/**\n * Contain the logic for the copy to clipboard modal, i.e. the modal contains a\n * readonly input text field, that contains a value. Clicking on the single\n * button \"Copy to clipboard\" in the footer, puts the content of the input\n * text field into the clipboard and closes the modal.\n *\n * Usage:\n * ModalCopyToClipboard.create(string:<stringToCopy>, string:<modalTitle>|null);\n *\n * @module core/modal_copy_to_clipboard\n * @copyright 2023 Stephan Robotta <stephan.robotta@bfh.ch>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Modal from 'core/modal';\nimport ModalFactory from 'core/modal_factory';\nimport 'core/copy_to_clipboard';\n\nexport default class CopyToClipboardModal extends Modal {\n static TYPE = 'core/copytoclipboard';\n static TEMPLATE = 'core/modal_copytoclipboard';\n\n constructor(...config) {\n // Override the constructor to set the removeOnClose property, and show the modal.\n super(...config);\n this.setRemoveOnClose(true);\n }\n\n /**\n * Set up all the event handling for the modal.\n * This is an override of the parent method, adding an event listener to close upon the action.\n *\n * @param {array} args\n */\n registerEventListeners(...args) {\n super.registerEventListeners(...args);\n\n this.getRoot().get(0).addEventListener('click', (e) => {\n if (!e.target.closest('[data-action=\"copytoclipboard\"]')) {\n return;\n }\n\n if (!this.getRoot().get(0).contains(e.target)) {\n return;\n }\n\n // Note: We must call destroy() here, because the copy-to-clipboard action listens on the document,\n // which will be processed after this event listener has been processed.\n // By placing this in a setTimeout we move its processing to after the event loop has finished.\n setTimeout(this.destroy.bind(this));\n });\n }\n\n /**\n * Create a new instance of the Modal. Set the text that is being copied. By default, the text is put into the\n * value of an input readonly field. If useTextArea is set to true, the text is rendered in a textarea element.\n * The optional title argument is for the modal title. If not set, the generic string \"copy to clipboard\" is used.\n *\n * @param {Object} data used in the template\n * @param {string} data.text the text to copy to the clipboard\n * @param {boolean} data.useTextArea when the text to copy is displayed in a textarea, default is input\n * @param {string|null} title\n * @returns {Promise<void>}\n */\n static async create(\n {\n text,\n useTextArea = false,\n } = {},\n title\n ) {\n this.registerModalType();\n\n const modal = await ModalFactory.create({\n type: this.TYPE,\n templateContext: {\n text: text,\n useTextArea: useTextArea,\n },\n });\n if (title) {\n modal.setTitle(title);\n }\n modal.show();\n }\n}\n"],"names":["CopyToClipboardModal","Modal","constructor","setRemoveOnClose","registerEventListeners","getRoot","get","addEventListener","e","target","closest","this","contains","setTimeout","destroy","bind","text","useTextArea","title","registerModalType","modal","ModalFactory","create","type","TYPE","templateContext","setTitle","show"],"mappings":"klBAiCqBA,6BAA6BC,eAI9CC,uCAGSC,kBAAiB,GAS1BC,+BACUA,0CAEDC,UAAUC,IAAI,GAAGC,iBAAiB,SAAUC,IACxCA,EAAEC,OAAOC,QAAQ,oCAIjBC,KAAKN,UAAUC,IAAI,GAAGM,SAASJ,EAAEC,SAOtCI,WAAWF,KAAKG,QAAQC,KAAKJ,oCAgBjCK,KACIA,KADJC,YAEIA,aAAc,0DACd,GACJC,kDAEKC,0BAECC,YAAcC,uBAAaC,OAAO,CACpCC,KAAMZ,KAAKa,KACXC,gBAAiB,CACbT,KAAMA,KACNC,YAAaA,eAGjBC,OACAE,MAAMM,SAASR,OAEnBE,MAAMO,qEAjEO3B,4BACH,wCADGA,gCAEC"}

View File

@ -1,10 +1,3 @@
define("core/modal_delete_cancel",["exports","core/modal","core/notification"],(function(_exports,_modal,_notification){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}
/**
* Contain the logic for the delete/cancel modal.
*
* @module core/modal_delete_cancel
* @copyright 2022 Laurent David <laurent.david@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_modal=_interopRequireDefault(_modal),_notification=_interopRequireDefault(_notification);class _default extends _modal.default{constructor(root){super(root),this.getFooter().find(this.getActionSelector("delete")).length||_notification.default.exception({message:"No delete button found"}),this.getFooter().find(this.getActionSelector("cancel")).length||_notification.default.exception({message:"No cancel button found"})}registerEventListeners(){super.registerEventListeners(),this.registerCloseOnDelete(),this.registerCloseOnCancel()}setFooter(){_notification.default.exception({message:"Can not change the footer of a delete cancel modal"})}setDeleteButtonText(value){return this.setButtonText("delete",value)}}return _exports.default=_default,_exports.default}));
define("core/modal_delete_cancel",["exports","core/modal","core/notification"],(function(_exports,_modal,_notification){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_modal=_interopRequireDefault(_modal),_notification=_interopRequireDefault(_notification);class ModalDeleteCancel extends _modal.default{constructor(root){super(root),this.getFooter().find(this.getActionSelector("delete")).length||_notification.default.exception({message:"No delete button found"}),this.getFooter().find(this.getActionSelector("cancel")).length||_notification.default.exception({message:"No cancel button found"})}registerEventListeners(){super.registerEventListeners(),this.registerCloseOnDelete(),this.registerCloseOnCancel()}setFooter(){_notification.default.exception({message:"Can not change the footer of a delete cancel modal"})}setDeleteButtonText(value){return this.setButtonText("delete",value)}}return _exports.default=ModalDeleteCancel,_defineProperty(ModalDeleteCancel,"TYPE","DELETE_CANCEL"),_defineProperty(ModalDeleteCancel,"TEMPLATE","core/modal_delete_cancel"),ModalDeleteCancel.registerModalType(),_exports.default}));
//# sourceMappingURL=modal_delete_cancel.min.js.map

View File

@ -1 +1 @@
{"version":3,"file":"modal_delete_cancel.min.js","sources":["../src/modal_delete_cancel.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 <http://www.gnu.org/licenses/>.\n\n/**\n * Contain the logic for the delete/cancel modal.\n *\n * @module core/modal_delete_cancel\n * @copyright 2022 Laurent David <laurent.david@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\nimport Modal from 'core/modal';\nimport Notification from 'core/notification';\n\n/**\n * The Delete/Cancel Modal.\n *\n * @class\n * @extends module:core/modal\n */\nexport default class extends Modal {\n constructor(root) {\n super(root);\n\n if (!this.getFooter().find(this.getActionSelector('delete')).length) {\n Notification.exception({message: 'No delete button found'});\n }\n\n if (!this.getFooter().find(this.getActionSelector('cancel')).length) {\n Notification.exception({message: 'No cancel button found'});\n }\n }\n\n /**\n * Register all event listeners.\n */\n registerEventListeners() {\n // Call the parent registration.\n super.registerEventListeners();\n\n // Register to close on delete/cancel.\n this.registerCloseOnDelete();\n this.registerCloseOnCancel();\n }\n\n /**\n * Override parent implementation to prevent changing the footer content.\n */\n setFooter() {\n Notification.exception({message: 'Can not change the footer of a delete cancel modal'});\n }\n\n /**\n * Set the title of the delete button.\n *\n * @param {String|Promise} value The button text, or a Promise which will resolve it\n * @returns{Promise}\n */\n setDeleteButtonText(value) {\n return this.setButtonText('delete', value);\n }\n}\n"],"names":["Modal","constructor","root","this","getFooter","find","getActionSelector","length","exception","message","registerEventListeners","registerCloseOnDelete","registerCloseOnCancel","setFooter","setDeleteButtonText","value","setButtonText"],"mappings":";;;;;;;sMA+B6BA,eACzBC,YAAYC,YACFA,MAEDC,KAAKC,YAAYC,KAAKF,KAAKG,kBAAkB,WAAWC,8BAC5CC,UAAU,CAACC,QAAS,2BAGhCN,KAAKC,YAAYC,KAAKF,KAAKG,kBAAkB,WAAWC,8BAC5CC,UAAU,CAACC,QAAS,2BAOzCC,+BAEUA,8BAGDC,6BACAC,wBAMTC,kCACiBL,UAAU,CAACC,QAAS,uDASrCK,oBAAoBC,cACTZ,KAAKa,cAAc,SAAUD"}
{"version":3,"file":"modal_delete_cancel.min.js","sources":["../src/modal_delete_cancel.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 <http://www.gnu.org/licenses/>.\n\n/**\n * Contain the logic for the delete/cancel modal.\n *\n * @module core/modal_delete_cancel\n * @copyright 2022 Laurent David <laurent.david@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\nimport Modal from 'core/modal';\nimport Notification from 'core/notification';\n\n/**\n * The Delete/Cancel Modal.\n *\n * @class\n * @extends module:core/modal\n */\nexport default class ModalDeleteCancel extends Modal {\n static TYPE = 'DELETE_CANCEL';\n static TEMPLATE = 'core/modal_delete_cancel';\n\n constructor(root) {\n super(root);\n\n if (!this.getFooter().find(this.getActionSelector('delete')).length) {\n Notification.exception({message: 'No delete button found'});\n }\n\n if (!this.getFooter().find(this.getActionSelector('cancel')).length) {\n Notification.exception({message: 'No cancel button found'});\n }\n }\n\n /**\n * Register all event listeners.\n */\n registerEventListeners() {\n // Call the parent registration.\n super.registerEventListeners();\n\n // Register to close on delete/cancel.\n this.registerCloseOnDelete();\n this.registerCloseOnCancel();\n }\n\n /**\n * Override parent implementation to prevent changing the footer content.\n */\n setFooter() {\n Notification.exception({message: 'Can not change the footer of a delete cancel modal'});\n }\n\n /**\n * Set the title of the delete button.\n *\n * @param {String|Promise} value The button text, or a Promise which will resolve it\n * @returns{Promise}\n */\n setDeleteButtonText(value) {\n return this.setButtonText('delete', value);\n }\n}\n\nModalDeleteCancel.registerModalType();\n"],"names":["ModalDeleteCancel","Modal","constructor","root","this","getFooter","find","getActionSelector","length","exception","message","registerEventListeners","registerCloseOnDelete","registerCloseOnCancel","setFooter","setDeleteButtonText","value","setButtonText","registerModalType"],"mappings":"8hBA+BqBA,0BAA0BC,eAI3CC,YAAYC,YACFA,MAEDC,KAAKC,YAAYC,KAAKF,KAAKG,kBAAkB,WAAWC,8BAC5CC,UAAU,CAACC,QAAS,2BAGhCN,KAAKC,YAAYC,KAAKF,KAAKG,kBAAkB,WAAWC,8BAC5CC,UAAU,CAACC,QAAS,2BAOzCC,+BAEUA,8BAGDC,6BACAC,wBAMTC,kCACiBL,UAAU,CAACC,QAAS,uDASrCK,oBAAoBC,cACTZ,KAAKa,cAAc,SAAUD,kEA1CvBhB,yBACH,iCADGA,6BAEC,4BA4CtBA,kBAAkBkB"}

View File

@ -5,6 +5,6 @@
* @copyright 2016 Ryan Wyllie <ryan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define("core/modal_factory",["jquery","core/modal_events","core/modal_registry","core/modal","core/modal_save_cancel","core/modal_delete_cancel","core/modal_cancel","core/local/modal/alert","core/templates","core/notification","core/custom_interaction_events","core/pending"],(function($,ModalEvents,ModalRegistry,Modal,ModalSaveCancel,ModalDeleteCancel,ModalCancel,ModalAlert,Templates,Notification,CustomEvents,Pending){var TEMPLATES_DEFAULT="core/modal",TEMPLATES_SAVE_CANCEL="core/modal_save_cancel",TEMPLATES_DELETE_CANCEL="core/modal_delete_cancel",TEMPLATES_CANCEL="core/modal_cancel",TEMPLATES_ALERT="core/local/modal/alert",TYPES={DEFAULT:"DEFAULT",SAVE_CANCEL:"SAVE_CANCEL",DELETE_CANCEL:"DELETE_CANCEL",CANCEL:"CANCEL",ALERT:"ALERT"};ModalRegistry.register(TYPES.DEFAULT,Modal,TEMPLATES_DEFAULT),ModalRegistry.register(TYPES.SAVE_CANCEL,ModalSaveCancel,TEMPLATES_SAVE_CANCEL),ModalRegistry.register(TYPES.DELETE_CANCEL,ModalDeleteCancel,TEMPLATES_DELETE_CANCEL),ModalRegistry.register(TYPES.CANCEL,ModalCancel,TEMPLATES_CANCEL),ModalRegistry.register(TYPES.ALERT,ModalAlert,TEMPLATES_ALERT);var createFromType=function(registryConf,templateContext){var templateName=registryConf.template,modalPromise=Templates.render(templateName,templateContext).then((function(html){var modalElement=$(html);return function(registryConf,modalElement){return modalElement=$(modalElement),new(0,registryConf.module)(modalElement)}(registryConf,modalElement)})).fail(Notification.exception);return modalPromise};return{create:function(modalConfig,triggerElement){var registryConf,type=modalConfig.type||TYPES.DEFAULT,isLarge=!!modalConfig.large,isScrollable=!modalConfig.hasOwnProperty("scrollable")||modalConfig.scrollable,templateContext={};(registryConf=ModalRegistry.get(type))||Notification.exception({message:"Unable to find modal of type: "+type}),void 0!==modalConfig.templateContext&&(templateContext=modalConfig.templateContext);var modalPromise=createFromType(registryConf,templateContext).then((function(modal){return void 0!==modalConfig.title&&modal.setTitle(modalConfig.title),void 0!==modalConfig.body&&modal.setBody(modalConfig.body),void 0!==modalConfig.footer&&modal.setFooter(modalConfig.footer),modalConfig.buttons&&Object.entries(modalConfig.buttons).forEach((function(_ref){let[key,value]=_ref;modal.setButtonText(key,value)})),isLarge&&modal.setLarge(),void 0!==modalConfig.removeOnClose&&modal.setRemoveOnClose(modalConfig.removeOnClose),modal.setScrollable(isScrollable),modal}));return void 0!==triggerElement&&function(modalPromise,triggerElement,modalConfig){var actualTriggerElement=null,hasPreShowCallback="function"==typeof modalConfig.preShowCallback,triggeredCallback=function(e,data){var pendingPromise=new Pending("core/modal_factory:setUpTrigger:triggeredCallback");actualTriggerElement=$(e.currentTarget),modalPromise.then((function(modal){return hasPreShowCallback&&modalConfig.preShowCallback(actualTriggerElement,modal),modal.show(),modal})).then(pendingPromise.resolve),data.originalEvent.preventDefault()};if(Array.isArray(triggerElement)){var selector=triggerElement[1];triggerElement=triggerElement[0],CustomEvents.define(triggerElement,[CustomEvents.events.activate]),triggerElement.on(CustomEvents.events.activate,selector,triggeredCallback)}else CustomEvents.define(triggerElement,[CustomEvents.events.activate]),triggerElement.on(CustomEvents.events.activate,triggeredCallback);modalPromise.then((function(modal){return modal.getRoot().on(ModalEvents.hidden,(function(){null!==actualTriggerElement&&actualTriggerElement.focus()})),modal}))}(modalPromise,triggerElement,modalConfig),modalPromise},types:TYPES}}));
define("core/modal_factory",["jquery","core/modal_events","core/modal_registry","core/modal","core/modal_save_cancel","core/modal_delete_cancel","core/modal_cancel","core/local/modal/alert","core/templates","core/notification","core/custom_interaction_events","core/pending"],(function($,ModalEvents,ModalRegistry,Modal,ModalSaveCancel,ModalDeleteCancel,ModalCancel,ModalAlert,Templates,Notification,CustomEvents,Pending){var TYPES={DEFAULT:"DEFAULT",SAVE_CANCEL:ModalSaveCancel.TYPE,DELETE_CANCEL:ModalDeleteCancel.TYPE,CANCEL:ModalCancel.TYPE,ALERT:ModalAlert.TYPE};ModalRegistry.register(TYPES.DEFAULT,Modal,Modal.TEMPLATE);var createFromType=function(registryConf,templateContext){var templateName=registryConf.template,modalPromise=Templates.render(templateName,templateContext).then((function(html){var modalElement=$(html);return function(registryConf,modalElement){return modalElement=$(modalElement),new(0,registryConf.module)(modalElement)}(registryConf,modalElement)})).fail(Notification.exception);return modalPromise};return{create:function(modalConfig,triggerElement){var registryConf,type=modalConfig.type||TYPES.DEFAULT,isLarge=!!modalConfig.large,isScrollable=!modalConfig.hasOwnProperty("scrollable")||modalConfig.scrollable,templateContext={};(registryConf=ModalRegistry.get(type))||Notification.exception({message:"Unable to find modal of type: "+type}),void 0!==modalConfig.templateContext&&(templateContext=modalConfig.templateContext);var modalPromise=createFromType(registryConf,templateContext).then((function(modal){return void 0!==modalConfig.title&&modal.setTitle(modalConfig.title),void 0!==modalConfig.body&&modal.setBody(modalConfig.body),void 0!==modalConfig.footer&&modal.setFooter(modalConfig.footer),modalConfig.buttons&&Object.entries(modalConfig.buttons).forEach((function(_ref){let[key,value]=_ref;modal.setButtonText(key,value)})),isLarge&&modal.setLarge(),void 0!==modalConfig.removeOnClose&&modal.setRemoveOnClose(modalConfig.removeOnClose),modal.setScrollable(isScrollable),modal}));return void 0!==triggerElement&&function(modalPromise,triggerElement,modalConfig){var actualTriggerElement=null,hasPreShowCallback="function"==typeof modalConfig.preShowCallback,triggeredCallback=function(e,data){var pendingPromise=new Pending("core/modal_factory:setUpTrigger:triggeredCallback");actualTriggerElement=$(e.currentTarget),modalPromise.then((function(modal){return hasPreShowCallback&&modalConfig.preShowCallback(actualTriggerElement,modal),modal.show(),modal})).then(pendingPromise.resolve),data.originalEvent.preventDefault()};if(Array.isArray(triggerElement)){var selector=triggerElement[1];triggerElement=triggerElement[0],CustomEvents.define(triggerElement,[CustomEvents.events.activate]),triggerElement.on(CustomEvents.events.activate,selector,triggeredCallback)}else CustomEvents.define(triggerElement,[CustomEvents.events.activate]),triggerElement.on(CustomEvents.events.activate,triggeredCallback);modalPromise.then((function(modal){return modal.getRoot().on(ModalEvents.hidden,(function(){null!==actualTriggerElement&&actualTriggerElement.focus()})),modal}))}(modalPromise,triggerElement,modalConfig),modalPromise},types:TYPES}}));
//# sourceMappingURL=modal_factory.min.js.map

File diff suppressed because one or more lines are too long

View File

@ -1,11 +1,11 @@
define("core/modal_registry",["exports","core/notification","core/prefetch"],(function(_exports,Notification,Prefetch){function _getRequireWildcardCache(nodeInterop){if("function"!=typeof WeakMap)return null;var cacheBabelInterop=new WeakMap,cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!=typeof obj&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!==key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}return newObj.default=obj,cache&&cache.set(obj,newObj),newObj}
/**
* A registry for the different types of modal.
*
* @module core/modal_registry
* @class modal_registry
* @copyright 2016 Ryan Wyllie <ryan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define("core/modal_registry",["core/notification","core/prefetch"],(function(Notification,Prefetch){var registry={},get=function(type){return registry[type]};return{register:function(type,module,template){get(type)&&Notification.exception({message:"Modal of type '"+type+"' is already registered"}),module&&"function"==typeof module||Notification.exception({message:"You must provide a modal module"}),template||Notification.exception({message:"You must provide a modal template"}),registry[type]={module:module,template:template},Prefetch.prefetchTemplate(template)},get:get}}));
* A registry for the different types of modal.
*
* @module core/modal_registry
* @class modal_registry
* @copyright 2016 Ryan Wyllie <ryan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.register=_exports.get=_exports.default=void 0,Notification=_interopRequireWildcard(Notification),Prefetch=_interopRequireWildcard(Prefetch);const registry=new Map,get=type=>registry.get(type);_exports.get=get;const register=(type,module,template)=>{const existing=get(type);existing&&existing.module!==module&&Notification.exception({message:"Modal of type '".concat(type,"' is already registered")}),module&&"function"==typeof module||Notification.exception({message:"You must provide a modal module"}),template||Notification.exception({message:"You must provide a modal template"}),registry.set(type,{module:module,template:template}),Prefetch.prefetchTemplate(template)};_exports.register=register;var _default={register:register,get:get};return _exports.default=_default,_exports.default}));
//# sourceMappingURL=modal_registry.min.js.map

View File

@ -1 +1 @@
{"version":3,"file":"modal_registry.min.js","sources":["../src/modal_registry.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 <http://www.gnu.org/licenses/>.\n\n/**\n * A registry for the different types of modal.\n *\n * @module core/modal_registry\n * @class modal_registry\n * @copyright 2016 Ryan Wyllie <ryan@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['core/notification', 'core/prefetch'], function(Notification, Prefetch) {\n\n // A singleton registry for all modules to access. Allows types to be\n // added at runtime.\n var registry = {};\n\n /**\n * Get a registered type of modal.\n *\n * @method get\n * @param {string} type The type of modal to get\n * @return {object} The registered config for the modal\n */\n var get = function(type) {\n return registry[type];\n };\n\n /**\n * Register a modal with the registry.\n *\n * @method register\n * @param {string} type The type of modal (must be unique)\n * @param {function} module The modal module (must be a constructor function of type core/modal)\n * @param {string} template The template name of the modal\n */\n var register = function(type, module, template) {\n if (get(type)) {\n Notification.exception({message: \"Modal of type '\" + type + \"' is already registered\"});\n }\n\n if (!module || typeof module !== 'function') {\n Notification.exception({message: \"You must provide a modal module\"});\n }\n\n if (!template) {\n Notification.exception({message: \"You must provide a modal template\"});\n }\n\n registry[type] = {\n module: module,\n template: template,\n };\n\n // Prefetch the template.\n Prefetch.prefetchTemplate(template);\n };\n\n return {\n register: register,\n get: get,\n };\n});\n"],"names":["define","Notification","Prefetch","registry","get","type","register","module","template","exception","message","prefetchTemplate"],"mappings":";;;;;;;;AAuBAA,6BAAO,CAAC,oBAAqB,kBAAkB,SAASC,aAAcC,cAI9DC,SAAW,GASXC,IAAM,SAASC,aACRF,SAASE,aAiCb,CACHC,SAvBW,SAASD,KAAME,OAAQC,UAC9BJ,IAAIC,OACJJ,aAAaQ,UAAU,CAACC,QAAS,mBAAqBL,KAAO,4BAG5DE,QAA4B,mBAAXA,QAClBN,aAAaQ,UAAU,CAACC,QAAS,oCAGhCF,UACDP,aAAaQ,UAAU,CAACC,QAAS,sCAGrCP,SAASE,MAAQ,CACbE,OAAQA,OACRC,SAAUA,UAIdN,SAASS,iBAAiBH,WAK1BJ,IAAKA"}
{"version":3,"file":"modal_registry.min.js","sources":["../src/modal_registry.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 <http://www.gnu.org/licenses/>.\n\n/**\n * A registry for the different types of modal.\n *\n * @module core/modal_registry\n * @class modal_registry\n * @copyright 2016 Ryan Wyllie <ryan@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\nimport * as Notification from 'core/notification';\nimport * as Prefetch from 'core/prefetch';\n\n// A singleton registry for all modules to access. Allows types to be\n// added at runtime.\nconst registry = new Map();\n\n/**\n * Get a registered type of modal.\n *\n * @method get\n * @param {string} type The type of modal to get\n * @return {object} The registered config for the modal\n */\nexport const get = (type) => registry.get(type);\n\n/**\n * Register a modal with the registry.\n *\n * @method register\n * @param {string} type The type of modal (must be unique)\n * @param {function} module The modal module (must be a constructor function of type core/modal)\n * @param {string} template The template name of the modal\n */\nexport const register = (type, module, template) => {\n const existing = get(type);\n if (existing && existing.module !== module) {\n Notification.exception({\n message: `Modal of type '${type}' is already registered`,\n });\n }\n\n if (!module || typeof module !== 'function') {\n Notification.exception({message: \"You must provide a modal module\"});\n }\n\n if (!template) {\n Notification.exception({message: \"You must provide a modal template\"});\n }\n\n registry.set(type, {module, template});\n\n // Prefetch the template.\n Prefetch.prefetchTemplate(template);\n};\n\nexport default {\n register,\n get,\n};\n"],"names":["registry","Map","get","type","register","module","template","existing","Notification","exception","message","set","Prefetch","prefetchTemplate"],"mappings":";;;;;;;;wNA4BMA,SAAW,IAAIC,IASRC,IAAOC,MAASH,SAASE,IAAIC,6BAU7BC,SAAW,CAACD,KAAME,OAAQC,kBAC7BC,SAAWL,IAAIC,MACjBI,UAAYA,SAASF,SAAWA,QAChCG,aAAaC,UAAU,CACnBC,kCAA4BP,kCAI/BE,QAA4B,mBAAXA,QAClBG,aAAaC,UAAU,CAACC,QAAS,oCAGhCJ,UACDE,aAAaC,UAAU,CAACC,QAAS,sCAGrCV,SAASW,IAAIR,KAAM,CAACE,OAAAA,OAAQC,SAAAA,WAG5BM,SAASC,iBAAiBP,mDAGf,CACXF,SAAAA,SACAF,IAAAA"}

View File

@ -1,10 +1,3 @@
define("core/modal_save_cancel",["exports","core/modal","core/notification"],(function(_exports,_modal,_notification){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}
/**
* Contain the logic for the save/cancel modal.
*
* @module core/modal_save_cancel
* @copyright 2016 Ryan Wyllie <ryan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_modal=_interopRequireDefault(_modal),_notification=_interopRequireDefault(_notification);class _default extends _modal.default{constructor(root){super(root),this.getFooter().find(this.getActionSelector("save")).length||_notification.default.exception({message:"No save button found"}),this.getFooter().find(this.getActionSelector("cancel")).length||_notification.default.exception({message:"No cancel button found"})}registerEventListeners(){super.registerEventListeners(),this.registerCloseOnSave(),this.registerCloseOnCancel()}setFooter(){_notification.default.exception({message:"Can not change the footer of a save cancel modal"})}setSaveButtonText(value){return this.setButtonText("save",value)}}return _exports.default=_default,_exports.default}));
define("core/modal_save_cancel",["exports","core/modal","core/notification"],(function(_exports,_modal,_notification){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_modal=_interopRequireDefault(_modal),_notification=_interopRequireDefault(_notification);class ModalSaveCancel extends _modal.default{constructor(root){super(root),this.getFooter().find(this.getActionSelector("save")).length||_notification.default.exception({message:"No save button found"}),this.getFooter().find(this.getActionSelector("cancel")).length||_notification.default.exception({message:"No cancel button found"})}registerEventListeners(){super.registerEventListeners(),this.registerCloseOnSave(),this.registerCloseOnCancel()}setFooter(){_notification.default.exception({message:"Can not change the footer of a save cancel modal"})}setSaveButtonText(value){return this.setButtonText("save",value)}}return _exports.default=ModalSaveCancel,_defineProperty(ModalSaveCancel,"TYPE","SAVE_CANCEL"),_defineProperty(ModalSaveCancel,"TEMPLATE","core/modal_save_cancel"),ModalSaveCancel.registerModalType(),_exports.default}));
//# sourceMappingURL=modal_save_cancel.min.js.map

View File

@ -1 +1 @@
{"version":3,"file":"modal_save_cancel.min.js","sources":["../src/modal_save_cancel.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 <http://www.gnu.org/licenses/>.\n\n/**\n * Contain the logic for the save/cancel modal.\n *\n * @module core/modal_save_cancel\n * @copyright 2016 Ryan Wyllie <ryan@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Modal from 'core/modal';\nimport Notification from 'core/notification';\n\n/**\n * The Save/Cancel Modal.\n *\n * @class\n * @extends module:core/modal\n */\nexport default class extends Modal {\n constructor(root) {\n super(root);\n\n if (!this.getFooter().find(this.getActionSelector('save')).length) {\n Notification.exception({message: 'No save button found'});\n }\n\n if (!this.getFooter().find(this.getActionSelector('cancel')).length) {\n Notification.exception({message: 'No cancel button found'});\n }\n }\n\n /**\n * Register all event listeners.\n */\n registerEventListeners() {\n // Call the parent registration.\n super.registerEventListeners();\n\n // Register to close on save/cancel.\n this.registerCloseOnSave();\n this.registerCloseOnCancel();\n }\n\n /**\n * Override parent implementation to prevent changing the footer content.\n */\n setFooter() {\n Notification.exception({message: 'Can not change the footer of a save cancel modal'});\n return;\n }\n\n /**\n * Set the title of the save button.\n *\n * @param {String|Promise} value The button text, or a Promise which will resolve it\n * @returns{Promise}\n */\n setSaveButtonText(value) {\n return this.setButtonText('save', value);\n }\n}\n"],"names":["Modal","constructor","root","this","getFooter","find","getActionSelector","length","exception","message","registerEventListeners","registerCloseOnSave","registerCloseOnCancel","setFooter","setSaveButtonText","value","setButtonText"],"mappings":";;;;;;;sMAgC6BA,eACzBC,YAAYC,YACFA,MAEDC,KAAKC,YAAYC,KAAKF,KAAKG,kBAAkB,SAASC,8BAC1CC,UAAU,CAACC,QAAS,yBAGhCN,KAAKC,YAAYC,KAAKF,KAAKG,kBAAkB,WAAWC,8BAC5CC,UAAU,CAACC,QAAS,2BAOzCC,+BAEUA,8BAGDC,2BACAC,wBAMTC,kCACiBL,UAAU,CAACC,QAAS,qDAUrCK,kBAAkBC,cACPZ,KAAKa,cAAc,OAAQD"}
{"version":3,"file":"modal_save_cancel.min.js","sources":["../src/modal_save_cancel.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 <http://www.gnu.org/licenses/>.\n\n/**\n * Contain the logic for the save/cancel modal.\n *\n * @module core/modal_save_cancel\n * @copyright 2016 Ryan Wyllie <ryan@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Modal from 'core/modal';\nimport Notification from 'core/notification';\n\n/**\n * The Save/Cancel Modal.\n *\n * @class\n * @extends module:core/modal\n */\nexport default class ModalSaveCancel extends Modal {\n static TYPE = 'SAVE_CANCEL';\n static TEMPLATE = 'core/modal_save_cancel';\n\n constructor(root) {\n super(root);\n\n if (!this.getFooter().find(this.getActionSelector('save')).length) {\n Notification.exception({message: 'No save button found'});\n }\n\n if (!this.getFooter().find(this.getActionSelector('cancel')).length) {\n Notification.exception({message: 'No cancel button found'});\n }\n }\n\n /**\n * Register all event listeners.\n */\n registerEventListeners() {\n // Call the parent registration.\n super.registerEventListeners();\n\n // Register to close on save/cancel.\n this.registerCloseOnSave();\n this.registerCloseOnCancel();\n }\n\n /**\n * Override parent implementation to prevent changing the footer content.\n */\n setFooter() {\n Notification.exception({message: 'Can not change the footer of a save cancel modal'});\n return;\n }\n\n /**\n * Set the title of the save button.\n *\n * @param {String|Promise} value The button text, or a Promise which will resolve it\n * @returns{Promise}\n */\n setSaveButtonText(value) {\n return this.setButtonText('save', value);\n }\n}\n\nModalSaveCancel.registerModalType();\n"],"names":["ModalSaveCancel","Modal","constructor","root","this","getFooter","find","getActionSelector","length","exception","message","registerEventListeners","registerCloseOnSave","registerCloseOnCancel","setFooter","setSaveButtonText","value","setButtonText","registerModalType"],"mappings":"4hBAgCqBA,wBAAwBC,eAIzCC,YAAYC,YACFA,MAEDC,KAAKC,YAAYC,KAAKF,KAAKG,kBAAkB,SAASC,8BAC1CC,UAAU,CAACC,QAAS,yBAGhCN,KAAKC,YAAYC,KAAKF,KAAKG,kBAAkB,WAAWC,8BAC5CC,UAAU,CAACC,QAAS,2BAOzCC,+BAEUA,8BAGDC,2BACAC,wBAMTC,kCACiBL,UAAU,CAACC,QAAS,qDAUrCK,kBAAkBC,cACPZ,KAAKa,cAAc,OAAQD,gEA3CrBhB,uBACH,+BADGA,2BAEC,0BA6CtBA,gBAAgBkB"}

View File

@ -1,3 +1,3 @@
define("core/moodlenet/send_activity_modal",["exports","core/modal","core/modal_registry"],(function(_exports,_modal,_modal_registry){var _class;function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_modal=_interopRequireDefault(_modal),_modal_registry=_interopRequireDefault(_modal_registry);const SendActivityModal=(_defineProperty(_class=class extends _modal.default{registerEventListeners(){super.registerEventListeners(),this.registerCloseOnSave(),this.registerCloseOnCancel()}},"TYPE","core/moodlenet/send_activity_modal"),_defineProperty(_class,"TEMPLATE","core/moodlenet/send_activity_modal_base"),_class);_modal_registry.default.register(SendActivityModal.TYPE,SendActivityModal,SendActivityModal.TEMPLATE);var _default=SendActivityModal;return _exports.default=_default,_exports.default}));
define("core/moodlenet/send_activity_modal",["exports","core/modal"],(function(_exports,_modal){var obj;function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_modal=(obj=_modal)&&obj.__esModule?obj:{default:obj};class SendActivityModal extends _modal.default{registerEventListeners(){super.registerEventListeners(),this.registerCloseOnSave(),this.registerCloseOnCancel()}}return _exports.default=SendActivityModal,_defineProperty(SendActivityModal,"TYPE","core/moodlenet/send_activity_modal"),_defineProperty(SendActivityModal,"TEMPLATE","core/moodlenet/send_activity_modal_base"),SendActivityModal.registerModalType(),_exports.default}));
//# sourceMappingURL=send_activity_modal.min.js.map

View File

@ -1 +1 @@
{"version":3,"file":"send_activity_modal.min.js","sources":["../../src/moodlenet/send_activity_modal.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 <http://www.gnu.org/licenses/>.\n\n/**\n * Send activity modal for MoodleNet.\n *\n * @module core/moodlenet/send_activity_modal\n * @copyright 2023 Huong Nguyen <huongnv13@gmail.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n * @since 4.2\n */\n\nimport Modal from 'core/modal';\nimport ModalRegistry from 'core/modal_registry';\n\nconst SendActivityModal = class extends Modal {\n static TYPE = 'core/moodlenet/send_activity_modal';\n static TEMPLATE = 'core/moodlenet/send_activity_modal_base';\n\n registerEventListeners() {\n // Call the parent registration.\n super.registerEventListeners();\n\n // Register to close on save/cancel.\n this.registerCloseOnSave();\n this.registerCloseOnCancel();\n }\n};\n\nModalRegistry.register(SendActivityModal.TYPE, SendActivityModal, SendActivityModal.TEMPLATE);\n\nexport default SendActivityModal;\n"],"names":["SendActivityModal","Modal","registerEventListeners","registerCloseOnSave","registerCloseOnCancel","register","TYPE","TEMPLATE"],"mappings":"2jBA2BMA,0CAAoB,cAAcC,eAIpCC,+BAEUA,8BAGDC,2BACAC,iCATK,wEACI,2EAYRC,SAASL,kBAAkBM,KAAMN,kBAAmBA,kBAAkBO,uBAErEP"}
{"version":3,"file":"send_activity_modal.min.js","sources":["../../src/moodlenet/send_activity_modal.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 <http://www.gnu.org/licenses/>.\n\n/**\n * Send activity modal for MoodleNet.\n *\n * @module core/moodlenet/send_activity_modal\n * @copyright 2023 Huong Nguyen <huongnv13@gmail.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n * @since 4.2\n */\n\nimport Modal from 'core/modal';\n\nexport default class SendActivityModal extends Modal {\n static TYPE = 'core/moodlenet/send_activity_modal';\n static TEMPLATE = 'core/moodlenet/send_activity_modal_base';\n\n registerEventListeners() {\n // Call the parent registration.\n super.registerEventListeners();\n\n // Register to close on save/cancel.\n this.registerCloseOnSave();\n this.registerCloseOnCancel();\n }\n}\n\nSendActivityModal.registerModalType();\n"],"names":["SendActivityModal","Modal","registerEventListeners","registerCloseOnSave","registerCloseOnCancel","registerModalType"],"mappings":"wZA0BqBA,0BAA0BC,eAI3CC,+BAEUA,8BAGDC,2BACAC,mFAVQJ,yBACH,sDADGA,6BAEC,2CAYtBA,kBAAkBK"}

View File

@ -29,7 +29,10 @@ import Modal from 'core/modal';
* @class
* @extends Modal
*/
export default class extends Modal {
export default class ModalAlert extends Modal {
static TYPE = 'ALERT';
static TEMPLATE = 'core/local/modal/alert';
/**
* Register all event listeners.
*/
@ -41,3 +44,5 @@ export default class extends Modal {
this.registerCloseOnCancel();
}
}
ModalAlert.registerModalType();

View File

@ -28,6 +28,7 @@ import * as Notification from 'core/notification';
import * as KeyCodes from 'core/key_codes';
import ModalBackdrop from 'core/modal_backdrop';
import ModalEvents from 'core/modal_events';
import * as ModalRegistry from 'core/modal_registry';
import Pending from 'core/pending';
import * as CustomEvents from 'core/custom_interaction_events';
import * as FilterEvents from 'core_filters/events';
@ -56,8 +57,11 @@ const TEMPLATES = {
};
export default class Modal {
/** @var {string} The template to use for this modal */
static TEMPLATE = 'core/modal';
/** @var {Promise} Module singleton for the backdrop to be reused by all Modal instances */
backdropPromise = null;
static backdropPromise = null;
/**
* @var {Number} A counter that gets incremented for each modal created.
@ -65,7 +69,6 @@ export default class Modal {
*/
static modalCounter = 0;
/**
* Constructor for the Modal.
*
@ -119,6 +122,24 @@ export default class Modal {
this.registerEventListeners();
}
/**
* Register a modal with the modal registry.
*/
static registerModalType() {
if (!this.TYPE) {
throw new Error(`Unknown modal type`, this);
}
if (!this.TEMPLATE) {
throw new Error(`Unknown modal template`, this);
}
ModalRegistry.register(
this.TYPE,
this,
this.TEMPLATE,
);
}
/**
* Attach the modal to the correct part of the page.
*

View File

@ -28,7 +28,10 @@ import Notification from 'core/notification';
* @class
* @extends module:core/modal
*/
export default class extends Modal {
export default class ModalCancel extends Modal {
static TYPE = 'CANCEL';
static TEMPLATE = 'core/modal_cancel';
constructor(root) {
super(root);
@ -48,3 +51,5 @@ export default class extends Modal {
this.registerCloseOnCancel();
}
}
ModalCancel.registerModalType();

View File

@ -28,7 +28,6 @@
*/
import Modal from 'core/modal';
import ModalRegistry from 'core/modal_registry';
import ModalFactory from 'core/modal_factory';
import 'core/copy_to_clipboard';
@ -85,9 +84,7 @@ export default class CopyToClipboardModal extends Modal {
} = {},
title
) {
if (!ModalRegistry.get(this.TYPE)) {
ModalRegistry.register(this.TYPE, this, this.TEMPLATE);
}
this.registerModalType();
const modal = await ModalFactory.create({
type: this.TYPE,
@ -101,4 +98,4 @@ export default class CopyToClipboardModal extends Modal {
}
modal.show();
}
}
}

View File

@ -29,7 +29,10 @@ import Notification from 'core/notification';
* @class
* @extends module:core/modal
*/
export default class extends Modal {
export default class ModalDeleteCancel extends Modal {
static TYPE = 'DELETE_CANCEL';
static TEMPLATE = 'core/modal_delete_cancel';
constructor(root) {
super(root);
@ -71,3 +74,5 @@ export default class extends Modal {
return this.setButtonText('delete', value);
}
}
ModalDeleteCancel.registerModalType();

View File

@ -27,15 +27,6 @@ define(['jquery', 'core/modal_events', 'core/modal_registry', 'core/modal',
function($, ModalEvents, ModalRegistry, Modal, ModalSaveCancel, ModalDeleteCancel,
ModalCancel, ModalAlert, Templates, Notification, CustomEvents, Pending) {
// The templates for each type of modal.
var TEMPLATES = {
DEFAULT: 'core/modal',
SAVE_CANCEL: 'core/modal_save_cancel',
DELETE_CANCEL: 'core/modal_delete_cancel',
CANCEL: 'core/modal_cancel',
ALERT: 'core/local/modal/alert',
};
/**
* The available types of modals.
*
@ -50,18 +41,14 @@ define(['jquery', 'core/modal_events', 'core/modal_registry', 'core/modal',
*/
var TYPES = {
DEFAULT: 'DEFAULT',
SAVE_CANCEL: 'SAVE_CANCEL',
DELETE_CANCEL: 'DELETE_CANCEL',
CANCEL: 'CANCEL',
ALERT: 'ALERT',
SAVE_CANCEL: ModalSaveCancel.TYPE,
DELETE_CANCEL: ModalDeleteCancel.TYPE,
CANCEL: ModalCancel.TYPE,
ALERT: ModalAlert.TYPE,
};
// Register the common set of modals.
ModalRegistry.register(TYPES.DEFAULT, Modal, TEMPLATES.DEFAULT);
ModalRegistry.register(TYPES.SAVE_CANCEL, ModalSaveCancel, TEMPLATES.SAVE_CANCEL);
ModalRegistry.register(TYPES.DELETE_CANCEL, ModalDeleteCancel, TEMPLATES.DELETE_CANCEL);
ModalRegistry.register(TYPES.CANCEL, ModalCancel, TEMPLATES.CANCEL);
ModalRegistry.register(TYPES.ALERT, ModalAlert, TEMPLATES.ALERT);
ModalRegistry.register(TYPES.DEFAULT, Modal, Modal.TEMPLATE);
/**
* Set up the events required to show the modal and return focus when the modal

View File

@ -21,55 +21,53 @@
* @copyright 2016 Ryan Wyllie <ryan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define(['core/notification', 'core/prefetch'], function(Notification, Prefetch) {
import * as Notification from 'core/notification';
import * as Prefetch from 'core/prefetch';
// A singleton registry for all modules to access. Allows types to be
// added at runtime.
var registry = {};
// A singleton registry for all modules to access. Allows types to be
// added at runtime.
const registry = new Map();
/**
* Get a registered type of modal.
*
* @method get
* @param {string} type The type of modal to get
* @return {object} The registered config for the modal
*/
var get = function(type) {
return registry[type];
};
/**
* Get a registered type of modal.
*
* @method get
* @param {string} type The type of modal to get
* @return {object} The registered config for the modal
*/
export const get = (type) => registry.get(type);
/**
* Register a modal with the registry.
*
* @method register
* @param {string} type The type of modal (must be unique)
* @param {function} module The modal module (must be a constructor function of type core/modal)
* @param {string} template The template name of the modal
*/
var register = function(type, module, template) {
if (get(type)) {
Notification.exception({message: "Modal of type '" + type + "' is already registered"});
}
/**
* Register a modal with the registry.
*
* @method register
* @param {string} type The type of modal (must be unique)
* @param {function} module The modal module (must be a constructor function of type core/modal)
* @param {string} template The template name of the modal
*/
export const register = (type, module, template) => {
const existing = get(type);
if (existing && existing.module !== module) {
Notification.exception({
message: `Modal of type '${type}' is already registered`,
});
}
if (!module || typeof module !== 'function') {
Notification.exception({message: "You must provide a modal module"});
}
if (!module || typeof module !== 'function') {
Notification.exception({message: "You must provide a modal module"});
}
if (!template) {
Notification.exception({message: "You must provide a modal template"});
}
if (!template) {
Notification.exception({message: "You must provide a modal template"});
}
registry[type] = {
module: module,
template: template,
};
registry.set(type, {module, template});
// Prefetch the template.
Prefetch.prefetchTemplate(template);
};
// Prefetch the template.
Prefetch.prefetchTemplate(template);
};
return {
register: register,
get: get,
};
});
export default {
register,
get,
};

View File

@ -30,7 +30,10 @@ import Notification from 'core/notification';
* @class
* @extends module:core/modal
*/
export default class extends Modal {
export default class ModalSaveCancel extends Modal {
static TYPE = 'SAVE_CANCEL';
static TEMPLATE = 'core/modal_save_cancel';
constructor(root) {
super(root);
@ -73,3 +76,5 @@ export default class extends Modal {
return this.setButtonText('save', value);
}
}
ModalSaveCancel.registerModalType();

View File

@ -23,9 +23,8 @@
*/
import Modal from 'core/modal';
import ModalRegistry from 'core/modal_registry';
const SendActivityModal = class extends Modal {
export default class SendActivityModal extends Modal {
static TYPE = 'core/moodlenet/send_activity_modal';
static TEMPLATE = 'core/moodlenet/send_activity_modal_base';
@ -37,8 +36,6 @@ const SendActivityModal = class extends Modal {
this.registerCloseOnSave();
this.registerCloseOnCancel();
}
};
}
ModalRegistry.register(SendActivityModal.TYPE, SendActivityModal, SendActivityModal.TEMPLATE);
export default SendActivityModal;
SendActivityModal.registerModalType();

View File

@ -1,3 +1,3 @@
define("tiny_equation/modal",["exports","core/modal","core/modal_registry"],(function(_exports,_modal,_modal_registry){var _class;function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_modal=_interopRequireDefault(_modal),_modal_registry=_interopRequireDefault(_modal_registry);const EquationModal=(_defineProperty(_class=class extends _modal.default{registerEventListeners(){super.registerEventListeners(),this.registerCloseOnSave(),this.registerCloseOnCancel()}},"TYPE","tiny_equation/modal"),_defineProperty(_class,"TEMPLATE","tiny_equation/modal"),_class);_modal_registry.default.register(EquationModal.TYPE,EquationModal,EquationModal.TEMPLATE);var _default=EquationModal;return _exports.default=_default,_exports.default}));
define("tiny_equation/modal",["exports","core/modal"],(function(_exports,_modal){var obj;function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_modal=(obj=_modal)&&obj.__esModule?obj:{default:obj};class EquationModal extends _modal.default{registerEventListeners(){super.registerEventListeners(),this.registerCloseOnSave(),this.registerCloseOnCancel()}}return _exports.default=EquationModal,_defineProperty(EquationModal,"TYPE","tiny_equation/modal"),_defineProperty(EquationModal,"TEMPLATE","tiny_equation/modal"),EquationModal.registerModalType(),_exports.default}));
//# sourceMappingURL=modal.min.js.map

View File

@ -1 +1 @@
{"version":3,"file":"modal.min.js","sources":["../src/modal.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 <http://www.gnu.org/licenses/>.\n\n/**\n * Equation Modal for Tiny.\n *\n * @module tiny_equation/modal\n * @copyright 2022 Huong Nguyen <huongnv13@gmail.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Modal from 'core/modal';\nimport ModalRegistry from 'core/modal_registry';\n\nconst EquationModal = class extends Modal {\n static TYPE = 'tiny_equation/modal';\n static TEMPLATE = 'tiny_equation/modal';\n\n registerEventListeners() {\n // Call the parent registration.\n super.registerEventListeners();\n\n // Register to close on save/cancel.\n this.registerCloseOnSave();\n this.registerCloseOnCancel();\n }\n};\n\nModalRegistry.register(EquationModal.TYPE, EquationModal, EquationModal.TEMPLATE);\n\nexport default EquationModal;\n"],"names":["EquationModal","Modal","registerEventListeners","registerCloseOnSave","registerCloseOnCancel","register","TYPE","TEMPLATE"],"mappings":"4iBA0BMA,sCAAgB,cAAcC,eAIhCC,+BAEUA,8BAGDC,2BACAC,iCATK,yDACI,uDAYRC,SAASL,cAAcM,KAAMN,cAAeA,cAAcO,uBAEzDP"}
{"version":3,"file":"modal.min.js","sources":["../src/modal.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 <http://www.gnu.org/licenses/>.\n\n/**\n * Equation Modal for Tiny.\n *\n * @module tiny_equation/modal\n * @copyright 2022 Huong Nguyen <huongnv13@gmail.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Modal from 'core/modal';\n\nexport default class EquationModal extends Modal {\n static TYPE = 'tiny_equation/modal';\n static TEMPLATE = 'tiny_equation/modal';\n\n registerEventListeners() {\n // Call the parent registration.\n super.registerEventListeners();\n\n // Register to close on save/cancel.\n this.registerCloseOnSave();\n this.registerCloseOnCancel();\n }\n}\n\nEquationModal.registerModalType();\n"],"names":["EquationModal","Modal","registerEventListeners","registerCloseOnSave","registerCloseOnCancel","registerModalType"],"mappings":"yYAyBqBA,sBAAsBC,eAIvCC,+BAEUA,8BAGDC,2BACAC,+EAVQJ,qBACH,uCADGA,yBAEC,uBAYtBA,cAAcK"}

View File

@ -22,9 +22,8 @@
*/
import Modal from 'core/modal';
import ModalRegistry from 'core/modal_registry';
const EquationModal = class extends Modal {
export default class EquationModal extends Modal {
static TYPE = 'tiny_equation/modal';
static TEMPLATE = 'tiny_equation/modal';
@ -36,8 +35,6 @@ const EquationModal = class extends Modal {
this.registerCloseOnSave();
this.registerCloseOnCancel();
}
};
}
ModalRegistry.register(EquationModal.TYPE, EquationModal, EquationModal.TEMPLATE);
export default EquationModal;
EquationModal.registerModalType();

View File

@ -1,3 +1,3 @@
define("tiny_h5p/modal",["exports","core/modal","core/modal_registry"],(function(_exports,_modal,_modal_registry){var _class;function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_modal=_interopRequireDefault(_modal),_modal_registry=_interopRequireDefault(_modal_registry);const H5PModal=(_defineProperty(_class=class extends _modal.default{registerEventListeners(){super.registerEventListeners(),this.registerCloseOnSave(),this.registerCloseOnCancel()}},"TYPE","tiny_h5p/modal"),_defineProperty(_class,"TEMPLATE","tiny_h5p/modal"),_class);_modal_registry.default.register(H5PModal.TYPE,H5PModal,H5PModal.TEMPLATE);var _default=H5PModal;return _exports.default=_default,_exports.default}));
define("tiny_h5p/modal",["exports","core/modal"],(function(_exports,_modal){var obj;function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_modal=(obj=_modal)&&obj.__esModule?obj:{default:obj};class H5PModal extends _modal.default{registerEventListeners(){super.registerEventListeners(),this.registerCloseOnSave(),this.registerCloseOnCancel()}}return _exports.default=H5PModal,_defineProperty(H5PModal,"TYPE","tiny_h5p/modal"),_defineProperty(H5PModal,"TEMPLATE","tiny_h5p/modal"),H5PModal.registerModalType(),_exports.default}));
//# sourceMappingURL=modal.min.js.map

View File

@ -1 +1 @@
{"version":3,"file":"modal.min.js","sources":["../src/modal.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 <http://www.gnu.org/licenses/>.\n\n/**\n * H5P Management Modal for Tiny.\n *\n * @module tiny_h5p/modal\n * @copyright 2022 Andrew Lyons <andrew@nicols.co.uk>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Modal from 'core/modal';\nimport ModalRegistry from 'core/modal_registry';\n\nconst H5PModal = class extends Modal {\n static TYPE = 'tiny_h5p/modal';\n\n static TEMPLATE = 'tiny_h5p/modal';\n\n registerEventListeners() {\n // Call the parent registration.\n super.registerEventListeners();\n\n // Register to close on save/cancel.\n this.registerCloseOnSave();\n this.registerCloseOnCancel();\n }\n};\n\nModalRegistry.register(H5PModal.TYPE, H5PModal, H5PModal.TEMPLATE);\n\nexport default H5PModal;\n"],"names":["H5PModal","Modal","registerEventListeners","registerCloseOnSave","registerCloseOnCancel","register","TYPE","TEMPLATE"],"mappings":"uiBA0BMA,iCAAW,cAAcC,eAK3BC,+BAEUA,8BAGDC,2BACAC,iCAVK,oDAEI,kDAYRC,SAASL,SAASM,KAAMN,SAAUA,SAASO,uBAE1CP"}
{"version":3,"file":"modal.min.js","sources":["../src/modal.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 <http://www.gnu.org/licenses/>.\n\n/**\n * H5P Management Modal for Tiny.\n *\n * @module tiny_h5p/modal\n * @copyright 2022 Andrew Lyons <andrew@nicols.co.uk>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Modal from 'core/modal';\n\nexport default class H5PModal extends Modal {\n static TYPE = 'tiny_h5p/modal';\n static TEMPLATE = 'tiny_h5p/modal';\n\n registerEventListeners() {\n // Call the parent registration.\n super.registerEventListeners();\n\n // Register to close on save/cancel.\n this.registerCloseOnSave();\n this.registerCloseOnCancel();\n }\n}\n\nH5PModal.registerModalType();\n"],"names":["H5PModal","Modal","registerEventListeners","registerCloseOnSave","registerCloseOnCancel","registerModalType"],"mappings":"oYAyBqBA,iBAAiBC,eAIlCC,+BAEUA,8BAGDC,2BACAC,0EAVQJ,gBACH,kCADGA,oBAEC,kBAYtBA,SAASK"}

View File

@ -22,11 +22,9 @@
*/
import Modal from 'core/modal';
import ModalRegistry from 'core/modal_registry';
const H5PModal = class extends Modal {
export default class H5PModal extends Modal {
static TYPE = 'tiny_h5p/modal';
static TEMPLATE = 'tiny_h5p/modal';
registerEventListeners() {
@ -37,8 +35,6 @@ const H5PModal = class extends Modal {
this.registerCloseOnSave();
this.registerCloseOnCancel();
}
};
}
ModalRegistry.register(H5PModal.TYPE, H5PModal, H5PModal.TEMPLATE);
export default H5PModal;
H5PModal.registerModalType();

View File

@ -1,3 +1,3 @@
define("tiny_link/modal",["exports","core/modal","core/modal_registry"],(function(_exports,_modal,_modal_registry){var _class;function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_modal=_interopRequireDefault(_modal),_modal_registry=_interopRequireDefault(_modal_registry);const LinkModal=(_defineProperty(_class=class extends _modal.default{registerEventListeners(){super.registerEventListeners(),this.registerCloseOnSave(),this.registerCloseOnCancel()}},"TYPE","tiny_link/modal"),_defineProperty(_class,"TEMPLATE","tiny_link/modal"),_class);_modal_registry.default.register(LinkModal.TYPE,LinkModal,LinkModal.TEMPLATE);var _default=LinkModal;return _exports.default=_default,_exports.default}));
define("tiny_link/modal",["exports","core/modal"],(function(_exports,_modal){var obj;function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_modal=(obj=_modal)&&obj.__esModule?obj:{default:obj};class LinkModal extends _modal.default{registerEventListeners(){super.registerEventListeners(),this.registerCloseOnSave(),this.registerCloseOnCancel()}}return _exports.default=LinkModal,_defineProperty(LinkModal,"TYPE","tiny_link/modal"),_defineProperty(LinkModal,"TEMPLATE","tiny_link/modal"),LinkModal.registerModalType(),_exports.default}));
//# sourceMappingURL=modal.min.js.map

View File

@ -1 +1 @@
{"version":3,"file":"modal.min.js","sources":["../src/modal.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 <http://www.gnu.org/licenses/>.\n\n/**\n * Link Modal for Tiny.\n *\n * @module tiny_link/modal\n * @copyright 2023 Huong Nguyen <huongnv13@gmail.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Modal from 'core/modal';\nimport ModalRegistry from 'core/modal_registry';\n\nconst LinkModal = class extends Modal {\n static TYPE = 'tiny_link/modal';\n static TEMPLATE = 'tiny_link/modal';\n\n registerEventListeners() {\n // Call the parent registration.\n super.registerEventListeners();\n\n // Register to close on save/cancel.\n this.registerCloseOnSave();\n this.registerCloseOnCancel();\n }\n};\n\nModalRegistry.register(LinkModal.TYPE, LinkModal, LinkModal.TEMPLATE);\n\nexport default LinkModal;\n"],"names":["LinkModal","Modal","registerEventListeners","registerCloseOnSave","registerCloseOnCancel","register","TYPE","TEMPLATE"],"mappings":"wiBA0BMA,kCAAY,cAAcC,eAI5BC,+BAEUA,8BAGDC,2BACAC,iCATK,qDACI,mDAYRC,SAASL,UAAUM,KAAMN,UAAWA,UAAUO,uBAE7CP"}
{"version":3,"file":"modal.min.js","sources":["../src/modal.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 <http://www.gnu.org/licenses/>.\n\n/**\n * Link Modal for Tiny.\n *\n * @module tiny_link/modal\n * @copyright 2023 Huong Nguyen <huongnv13@gmail.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Modal from 'core/modal';\n\nexport default class LinkModal extends Modal {\n static TYPE = 'tiny_link/modal';\n static TEMPLATE = 'tiny_link/modal';\n\n registerEventListeners() {\n // Call the parent registration.\n super.registerEventListeners();\n\n // Register to close on save/cancel.\n this.registerCloseOnSave();\n this.registerCloseOnCancel();\n }\n}\n\nLinkModal.registerModalType();\n"],"names":["LinkModal","Modal","registerEventListeners","registerCloseOnSave","registerCloseOnCancel","registerModalType"],"mappings":"qYAyBqBA,kBAAkBC,eAInCC,+BAEUA,8BAGDC,2BACAC,2EAVQJ,iBACH,mCADGA,qBAEC,mBAYtBA,UAAUK"}

View File

@ -22,9 +22,8 @@
*/
import Modal from 'core/modal';
import ModalRegistry from 'core/modal_registry';
const LinkModal = class extends Modal {
export default class LinkModal extends Modal {
static TYPE = 'tiny_link/modal';
static TEMPLATE = 'tiny_link/modal';
@ -36,8 +35,6 @@ const LinkModal = class extends Modal {
this.registerCloseOnSave();
this.registerCloseOnCancel();
}
};
}
ModalRegistry.register(LinkModal.TYPE, LinkModal, LinkModal.TEMPLATE);
export default LinkModal;
LinkModal.registerModalType();

View File

@ -1,3 +1,3 @@
define("tiny_media/embedmodal",["exports","core/modal","core/modal_registry","./common"],(function(_exports,_modal,_modal_registry,_common){var _class;function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_modal=_interopRequireDefault(_modal),_modal_registry=_interopRequireDefault(_modal_registry);const EmbedModal=(_defineProperty(_class=class extends _modal.default{registerEventListeners(){super.registerEventListeners(),this.registerCloseOnSave(),this.registerCloseOnCancel()}},"TYPE","".concat(_common.component,"/modal")),_defineProperty(_class,"TEMPLATE","".concat(_common.component,"/embed_media_modal")),_class);_modal_registry.default.register(EmbedModal.TYPE,EmbedModal,EmbedModal.TEMPLATE);var _default=EmbedModal;return _exports.default=_default,_exports.default}));
define("tiny_media/embedmodal",["exports","core/modal","./common"],(function(_exports,_modal,_common){var obj;function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_modal=(obj=_modal)&&obj.__esModule?obj:{default:obj};class EmbedModal extends _modal.default{registerEventListeners(){super.registerEventListeners(),this.registerCloseOnSave(),this.registerCloseOnCancel()}}return _exports.default=EmbedModal,_defineProperty(EmbedModal,"TYPE","".concat(_common.component,"/modal")),_defineProperty(EmbedModal,"TEMPLATE","".concat(_common.component,"/embed_media_modal")),EmbedModal.registerModalType(),_exports.default}));
//# sourceMappingURL=embedmodal.min.js.map

View File

@ -1 +1 @@
{"version":3,"file":"embedmodal.min.js","sources":["../src/embedmodal.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 <http://www.gnu.org/licenses/>.\n\n/**\n * Embedded Media Management Modal for Tiny.\n *\n * @module tiny_media/embedmodal\n * @copyright 2022 Andrew Lyons <andrew@nicols.co.uk>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Modal from 'core/modal';\nimport ModalRegistry from 'core/modal_registry';\nimport {component} from './common';\n\nconst EmbedModal = class extends Modal {\n static TYPE = `${component}/modal`;\n\n static TEMPLATE = `${component}/embed_media_modal`;\n\n registerEventListeners() {\n // Call the parent registration.\n super.registerEventListeners();\n\n // Register to close on save/cancel.\n this.registerCloseOnSave();\n this.registerCloseOnCancel();\n }\n};\n\nModalRegistry.register(EmbedModal.TYPE, EmbedModal, EmbedModal.TEMPLATE);\n\nexport default EmbedModal;\n"],"names":["EmbedModal","Modal","registerEventListeners","registerCloseOnSave","registerCloseOnCancel","component","register","TYPE","TEMPLATE"],"mappings":"ikBA2BMA,mCAAa,cAAcC,eAK7BC,+BAEUA,8BAGDC,2BACAC,2CAVQC,yEAEIA,yEAYXC,SAASN,WAAWO,KAAMP,WAAYA,WAAWQ,uBAEhDR"}
{"version":3,"file":"embedmodal.min.js","sources":["../src/embedmodal.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 <http://www.gnu.org/licenses/>.\n\n/**\n * Embedded Media Management Modal for Tiny.\n *\n * @module tiny_media/embedmodal\n * @copyright 2022 Andrew Lyons <andrew@nicols.co.uk>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Modal from 'core/modal';\nimport {component} from './common';\n\nexport default class EmbedModal extends Modal {\n static TYPE = `${component}/modal`;\n static TEMPLATE = `${component}/embed_media_modal`;\n\n registerEventListeners() {\n // Call the parent registration.\n super.registerEventListeners();\n\n // Register to close on save/cancel.\n this.registerCloseOnSave();\n this.registerCloseOnCancel();\n }\n}\n\nEmbedModal.registerModalType();\n"],"names":["EmbedModal","Modal","registerEventListeners","registerCloseOnSave","registerCloseOnCancel","component","registerModalType"],"mappings":"8ZA0BqBA,mBAAmBC,eAIpCC,+BAEUA,8BAGDC,2BACAC,4EAVQJ,4BACAK,6CADAL,gCAEIK,yCAYzBL,WAAWM"}

View File

@ -1,3 +1,3 @@
define("tiny_media/imagemodal",["exports","core/modal","core/modal_registry","./common"],(function(_exports,_modal,_modal_registry,_common){var _class;function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_modal=_interopRequireDefault(_modal),_modal_registry=_interopRequireDefault(_modal_registry);const ImageModal=(_defineProperty(_class=class extends _modal.default{registerEventListeners(){super.registerEventListeners(),this.registerCloseOnSave(),this.registerCloseOnCancel()}},"TYPE","".concat(_common.component,"/imagemodal")),_defineProperty(_class,"TEMPLATE","".concat(_common.component,"/insert_image_modal")),_class);_modal_registry.default.register(ImageModal.TYPE,ImageModal,ImageModal.TEMPLATE);var _default=ImageModal;return _exports.default=_default,_exports.default}));
define("tiny_media/imagemodal",["exports","core/modal","./common"],(function(_exports,_modal,_common){var obj;function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_modal=(obj=_modal)&&obj.__esModule?obj:{default:obj};class ImageModal extends _modal.default{registerEventListeners(){super.registerEventListeners(),this.registerCloseOnSave(),this.registerCloseOnCancel()}}return _exports.default=ImageModal,_defineProperty(ImageModal,"TYPE","".concat(_common.component,"/imagemodal")),_defineProperty(ImageModal,"TEMPLATE","".concat(_common.component,"/insert_image_modal")),ImageModal.registerModalType(),_exports.default}));
//# sourceMappingURL=imagemodal.min.js.map

View File

@ -1 +1 @@
{"version":3,"file":"imagemodal.min.js","sources":["../src/imagemodal.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 <http://www.gnu.org/licenses/>.\n\n/**\n * Image Modal for Tiny.\n *\n * @module tiny_media/imagemodal\n * @copyright 2022 Huong Nguyen <huongnv13@gmail.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Modal from 'core/modal';\nimport ModalRegistry from 'core/modal_registry';\nimport {component} from './common';\n\nconst ImageModal = class extends Modal {\n static TYPE = `${component}/imagemodal`;\n\n static TEMPLATE = `${component}/insert_image_modal`;\n\n registerEventListeners() {\n // Call the parent registration.\n super.registerEventListeners();\n\n // Register to close on save/cancel.\n this.registerCloseOnSave();\n this.registerCloseOnCancel();\n }\n};\n\nModalRegistry.register(ImageModal.TYPE, ImageModal, ImageModal.TEMPLATE);\n\nexport default ImageModal;\n"],"names":["ImageModal","Modal","registerEventListeners","registerCloseOnSave","registerCloseOnCancel","component","register","TYPE","TEMPLATE"],"mappings":"ikBA2BMA,mCAAa,cAAcC,eAK7BC,+BAEUA,8BAGDC,2BACAC,2CAVQC,8EAEIA,0EAYXC,SAASN,WAAWO,KAAMP,WAAYA,WAAWQ,uBAEhDR"}
{"version":3,"file":"imagemodal.min.js","sources":["../src/imagemodal.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 <http://www.gnu.org/licenses/>.\n\n/**\n * Image Modal for Tiny.\n *\n * @module tiny_media/imagemodal\n * @copyright 2022 Huong Nguyen <huongnv13@gmail.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Modal from 'core/modal';\nimport {component} from './common';\n\nexport default class ImageModal extends Modal {\n static TYPE = `${component}/imagemodal`;\n static TEMPLATE = `${component}/insert_image_modal`;\n\n registerEventListeners() {\n // Call the parent registration.\n super.registerEventListeners();\n\n // Register to close on save/cancel.\n this.registerCloseOnSave();\n this.registerCloseOnCancel();\n }\n}\n\nImageModal.registerModalType();\n"],"names":["ImageModal","Modal","registerEventListeners","registerCloseOnSave","registerCloseOnCancel","component","registerModalType"],"mappings":"8ZA0BqBA,mBAAmBC,eAIpCC,+BAEUA,8BAGDC,2BACAC,4EAVQJ,4BACAK,kDADAL,gCAEIK,0CAYzBL,WAAWM"}

View File

@ -22,12 +22,10 @@
*/
import Modal from 'core/modal';
import ModalRegistry from 'core/modal_registry';
import {component} from './common';
const EmbedModal = class extends Modal {
export default class EmbedModal extends Modal {
static TYPE = `${component}/modal`;
static TEMPLATE = `${component}/embed_media_modal`;
registerEventListeners() {
@ -38,8 +36,6 @@ const EmbedModal = class extends Modal {
this.registerCloseOnSave();
this.registerCloseOnCancel();
}
};
}
ModalRegistry.register(EmbedModal.TYPE, EmbedModal, EmbedModal.TEMPLATE);
export default EmbedModal;
EmbedModal.registerModalType();

View File

@ -22,12 +22,10 @@
*/
import Modal from 'core/modal';
import ModalRegistry from 'core/modal_registry';
import {component} from './common';
const ImageModal = class extends Modal {
export default class ImageModal extends Modal {
static TYPE = `${component}/imagemodal`;
static TEMPLATE = `${component}/insert_image_modal`;
registerEventListeners() {
@ -38,8 +36,6 @@ const ImageModal = class extends Modal {
this.registerCloseOnSave();
this.registerCloseOnCancel();
}
};
}
ModalRegistry.register(ImageModal.TYPE, ImageModal, ImageModal.TEMPLATE);
export default ImageModal;
ImageModal.registerModalType();

View File

@ -1,3 +1,3 @@
define("tiny_recordrtc/audio_recorder",["exports","./base_recorder","./modal","core/modal_registry","tiny_recordrtc/common"],(function(_exports,_base_recorder,_modal,_modal_registry,_common){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_base_recorder=_interopRequireDefault(_base_recorder),_modal=_interopRequireDefault(_modal),_modal_registry=_interopRequireDefault(_modal_registry);class Audio extends _base_recorder.default{configurePlayer(){return this.modalRoot.querySelector("audio")}getSupportedTypes(){return["audio/webm;codecs=opus","audio/ogg;codecs=opus"]}getParsedRecordingOptions(){return{audioBitsPerSecond:parseInt(this.config.audiobitrate)}}getMediaConstraints(){return{audio:!0}}getRecordingType(){return"audio"}getTimeLimit(){return this.config.audiotimelimit}getEmbedTemplateName(){return"tiny_recordrtc/embed_audio"}getFileName(prefix){return"".concat(prefix,"-audio.ogg")}static getModalClass(){var _class;const modalType="".concat(_common.component,"/audio_recorder"),registration=_modal_registry.default.get(modalType);if(registration)return registration.module;const AudioModal=(_defineProperty(_class=class extends _modal.default{},"TYPE",modalType),_defineProperty(_class,"TEMPLATE","".concat(_common.component,"/audio_recorder")),_class);return _modal_registry.default.register(AudioModal.TYPE,AudioModal,AudioModal.TEMPLATE),AudioModal}}return _exports.default=Audio,_exports.default}));
define("tiny_recordrtc/audio_recorder",["exports","./base_recorder","./modal","tiny_recordrtc/common"],(function(_exports,_base_recorder,_modal,_common){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_base_recorder=_interopRequireDefault(_base_recorder),_modal=_interopRequireDefault(_modal);class Audio extends _base_recorder.default{configurePlayer(){return this.modalRoot.querySelector("audio")}getSupportedTypes(){return["audio/webm;codecs=opus","audio/ogg;codecs=opus"]}getParsedRecordingOptions(){return{audioBitsPerSecond:parseInt(this.config.audiobitrate)}}getMediaConstraints(){return{audio:!0}}getRecordingType(){return"audio"}getTimeLimit(){return this.config.audiotimelimit}getEmbedTemplateName(){return"tiny_recordrtc/embed_audio"}getFileName(prefix){return"".concat(prefix,"-audio.ogg")}static getModalClass(){var _class;const AudioModal=(_defineProperty(_class=class extends _modal.default{},"TYPE","".concat(_common.component,"/audio_recorder")),_defineProperty(_class,"TEMPLATE","".concat(_common.component,"/audio_recorder")),_class);return AudioModal.registerModalType(),AudioModal}}return _exports.default=Audio,_exports.default}));
//# sourceMappingURL=audio_recorder.min.js.map

View File

@ -1 +1 @@
{"version":3,"file":"audio_recorder.min.js","sources":["../src/audio_recorder.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 <http://www.gnu.org/licenses/>.\n\n/**\n * Tiny Record RTC - audio recorder configuration.\n *\n * @module tiny_recordrtc/audio_recorder\n * @copyright 2022 Stevani Andolo <stevani@hotmail.com.au>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport BaseClass from './base_recorder';\nimport Modal from './modal';\nimport ModalRegistry from 'core/modal_registry';\nimport {component} from 'tiny_recordrtc/common';\n\nexport default class Audio extends BaseClass {\n configurePlayer() {\n return this.modalRoot.querySelector('audio');\n }\n\n getSupportedTypes() {\n return [\n 'audio/webm;codecs=opus',\n 'audio/ogg;codecs=opus',\n ];\n }\n\n getParsedRecordingOptions() {\n return {\n audioBitsPerSecond: parseInt(this.config.audiobitrate),\n };\n }\n\n getMediaConstraints() {\n return {\n audio: true,\n };\n }\n\n getRecordingType() {\n return 'audio';\n }\n\n getTimeLimit() {\n return this.config.audiotimelimit;\n }\n\n getEmbedTemplateName() {\n return 'tiny_recordrtc/embed_audio';\n }\n\n getFileName(prefix) {\n return `${prefix}-audio.ogg`;\n }\n\n static getModalClass() {\n const modalType = `${component}/audio_recorder`;\n const registration = ModalRegistry.get(modalType);\n if (registration) {\n return registration.module;\n }\n\n const AudioModal = class extends Modal {\n static TYPE = modalType;\n static TEMPLATE = `${component}/audio_recorder`;\n };\n\n ModalRegistry.register(AudioModal.TYPE, AudioModal, AudioModal.TEMPLATE);\n return AudioModal;\n }\n}\n"],"names":["Audio","BaseClass","configurePlayer","this","modalRoot","querySelector","getSupportedTypes","getParsedRecordingOptions","audioBitsPerSecond","parseInt","config","audiobitrate","getMediaConstraints","audio","getRecordingType","getTimeLimit","audiotimelimit","getEmbedTemplateName","getFileName","prefix","modalType","component","registration","ModalRegistry","get","module","AudioModal","Modal","register","TYPE","TEMPLATE"],"mappings":"+pBA4BqBA,cAAcC,uBAC/BC,yBACWC,KAAKC,UAAUC,cAAc,SAGxCC,0BACW,CACH,yBACA,yBAIRC,kCACW,CACHC,mBAAoBC,SAASN,KAAKO,OAAOC,eAIjDC,4BACW,CACHC,OAAO,GAIfC,yBACW,QAGXC,sBACWZ,KAAKO,OAAOM,eAGvBC,6BACW,6BAGXC,YAAYC,wBACEA,6DAIJC,oBAAeC,qCACfC,aAAeC,wBAAcC,IAAIJ,cACnCE,oBACOA,aAAaG,aAGlBC,mCAAa,cAAcC,wBACfP,uDACOC,6EAGXO,SAASF,WAAWG,KAAMH,WAAYA,WAAWI,UACxDJ"}
{"version":3,"file":"audio_recorder.min.js","sources":["../src/audio_recorder.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 <http://www.gnu.org/licenses/>.\n\n/**\n * Tiny Record RTC - audio recorder configuration.\n *\n * @module tiny_recordrtc/audio_recorder\n * @copyright 2022 Stevani Andolo <stevani@hotmail.com.au>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport BaseClass from './base_recorder';\nimport Modal from './modal';\nimport {component} from 'tiny_recordrtc/common';\n\nexport default class Audio extends BaseClass {\n configurePlayer() {\n return this.modalRoot.querySelector('audio');\n }\n\n getSupportedTypes() {\n return [\n 'audio/webm;codecs=opus',\n 'audio/ogg;codecs=opus',\n ];\n }\n\n getParsedRecordingOptions() {\n return {\n audioBitsPerSecond: parseInt(this.config.audiobitrate),\n };\n }\n\n getMediaConstraints() {\n return {\n audio: true,\n };\n }\n\n getRecordingType() {\n return 'audio';\n }\n\n getTimeLimit() {\n return this.config.audiotimelimit;\n }\n\n getEmbedTemplateName() {\n return 'tiny_recordrtc/embed_audio';\n }\n\n getFileName(prefix) {\n return `${prefix}-audio.ogg`;\n }\n\n static getModalClass() {\n const AudioModal = class extends Modal {\n static TYPE = `${component}/audio_recorder`;\n static TEMPLATE = `${component}/audio_recorder`;\n };\n\n AudioModal.registerModalType();\n return AudioModal;\n }\n}\n"],"names":["Audio","BaseClass","configurePlayer","this","modalRoot","querySelector","getSupportedTypes","getParsedRecordingOptions","audioBitsPerSecond","parseInt","config","audiobitrate","getMediaConstraints","audio","getRecordingType","getTimeLimit","audiotimelimit","getEmbedTemplateName","getFileName","prefix","AudioModal","Modal","component","registerModalType"],"mappings":"ikBA2BqBA,cAAcC,uBAC/BC,yBACWC,KAAKC,UAAUC,cAAc,SAGxCC,0BACW,CACH,yBACA,yBAIRC,kCACW,CACHC,mBAAoBC,SAASN,KAAKO,OAAOC,eAIjDC,4BACW,CACHC,OAAO,GAIfC,yBACW,QAGXC,sBACWZ,KAAKO,OAAOM,eAGvBC,6BACW,6BAGXC,YAAYC,wBACEA,6DAIJC,mCAAa,cAAcC,kCACZC,kFACIA,qDAGzBF,WAAWG,oBACJH"}

View File

@ -1,3 +1,3 @@
define("tiny_recordrtc/video_recorder",["exports","./base_recorder","tiny_recordrtc/modal","core/modal_registry","tiny_recordrtc/common"],(function(_exports,_base_recorder,_modal,_modal_registry,_common){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_base_recorder=_interopRequireDefault(_base_recorder),_modal=_interopRequireDefault(_modal),_modal_registry=_interopRequireDefault(_modal_registry);class Video extends _base_recorder.default{configurePlayer(){return this.modalRoot.querySelector("video")}getSupportedTypes(){return["video/webm;codecs=vp9,opus","video/webm;codecs=h264,opus","video/webm;codecs=vp8,opus"]}getParsedRecordingOptions(){return{audioBitsPerSecond:parseInt(this.config.audiobitrate),videoBitsPerSecond:parseInt(this.config.videobitrate)}}getMediaConstraints(){return{audio:!0,video:{width:{ideal:640},height:{ideal:480}}}}playOnCapture(){return!0}getRecordingType(){return"video"}getTimeLimit(){return this.config.videotimelimit}getEmbedTemplateName(){return"tiny_recordrtc/embed_video"}getFileName(prefix){return"".concat(prefix,"-video.webm")}static getModalClass(){var _class;const modalType="".concat(_common.component,"/video_recorder"),registration=_modal_registry.default.get(modalType);if(registration)return registration.module;const VideoModal=(_defineProperty(_class=class extends _modal.default{},"TYPE",modalType),_defineProperty(_class,"TEMPLATE","".concat(_common.component,"/video_recorder")),_class);return _modal_registry.default.register(VideoModal.TYPE,VideoModal,VideoModal.TEMPLATE),VideoModal}}return _exports.default=Video,_exports.default}));
define("tiny_recordrtc/video_recorder",["exports","./base_recorder","tiny_recordrtc/modal","tiny_recordrtc/common"],(function(_exports,_base_recorder,_modal,_common){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_base_recorder=_interopRequireDefault(_base_recorder),_modal=_interopRequireDefault(_modal);class Video extends _base_recorder.default{configurePlayer(){return this.modalRoot.querySelector("video")}getSupportedTypes(){return["video/webm;codecs=vp9,opus","video/webm;codecs=h264,opus","video/webm;codecs=vp8,opus"]}getParsedRecordingOptions(){return{audioBitsPerSecond:parseInt(this.config.audiobitrate),videoBitsPerSecond:parseInt(this.config.videobitrate)}}getMediaConstraints(){return{audio:!0,video:{width:{ideal:640},height:{ideal:480}}}}playOnCapture(){return!0}getRecordingType(){return"video"}getTimeLimit(){return this.config.videotimelimit}getEmbedTemplateName(){return"tiny_recordrtc/embed_video"}getFileName(prefix){return"".concat(prefix,"-video.webm")}static getModalClass(){var _class;const VideoModal=(_defineProperty(_class=class extends _modal.default{},"TYPE","".concat(_common.component,"/video_recorder")),_defineProperty(_class,"TEMPLATE","".concat(_common.component,"/video_recorder")),_class);return VideoModal.registerModalType(),VideoModal}}return _exports.default=Video,_exports.default}));
//# sourceMappingURL=video_recorder.min.js.map

View File

@ -1 +1 @@
{"version":3,"file":"video_recorder.min.js","sources":["../src/video_recorder.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 <http://www.gnu.org/licenses/>.\n\n/**\n * Tiny Record RTC - Video recorder configuration.\n *\n * @module tiny_recordrtc/video_recorder\n * @copyright 2022 Stevani Andolo <stevani@hotmail.com.au>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport BaseClass from './base_recorder';\nimport Modal from 'tiny_recordrtc/modal';\nimport ModalRegistry from 'core/modal_registry';\nimport {component} from 'tiny_recordrtc/common';\n\nexport default class Video extends BaseClass {\n configurePlayer() {\n return this.modalRoot.querySelector('video');\n }\n\n getSupportedTypes() {\n return [\n 'video/webm;codecs=vp9,opus',\n 'video/webm;codecs=h264,opus',\n 'video/webm;codecs=vp8,opus',\n ];\n\n }\n\n getParsedRecordingOptions() {\n return {\n audioBitsPerSecond: parseInt(this.config.audiobitrate),\n videoBitsPerSecond: parseInt(this.config.videobitrate)\n };\n }\n\n getMediaConstraints() {\n return {\n audio: true,\n video: {\n width: {\n ideal: 640,\n },\n height: {\n ideal: 480,\n },\n },\n };\n }\n\n playOnCapture() {\n // Play the recording back on capture.\n return true;\n }\n\n getRecordingType() {\n return 'video';\n }\n\n getTimeLimit() {\n return this.config.videotimelimit;\n }\n\n getEmbedTemplateName() {\n return 'tiny_recordrtc/embed_video';\n }\n\n getFileName(prefix) {\n return `${prefix}-video.webm`;\n }\n\n static getModalClass() {\n const modalType = `${component}/video_recorder`;\n const registration = ModalRegistry.get(modalType);\n if (registration) {\n return registration.module;\n }\n\n const VideoModal = class extends Modal {\n static TYPE = modalType;\n static TEMPLATE = `${component}/video_recorder`;\n };\n\n ModalRegistry.register(VideoModal.TYPE, VideoModal, VideoModal.TEMPLATE);\n return VideoModal;\n }\n}\n"],"names":["Video","BaseClass","configurePlayer","this","modalRoot","querySelector","getSupportedTypes","getParsedRecordingOptions","audioBitsPerSecond","parseInt","config","audiobitrate","videoBitsPerSecond","videobitrate","getMediaConstraints","audio","video","width","ideal","height","playOnCapture","getRecordingType","getTimeLimit","videotimelimit","getEmbedTemplateName","getFileName","prefix","modalType","component","registration","ModalRegistry","get","module","VideoModal","Modal","register","TYPE","TEMPLATE"],"mappings":"4qBA4BqBA,cAAcC,uBAC/BC,yBACWC,KAAKC,UAAUC,cAAc,SAGxCC,0BACW,CACH,6BACA,8BACA,8BAKRC,kCACW,CACHC,mBAAoBC,SAASN,KAAKO,OAAOC,cACzCC,mBAAoBH,SAASN,KAAKO,OAAOG,eAIjDC,4BACW,CACHC,OAAO,EACPC,MAAO,CACHC,MAAO,CACHC,MAAO,KAEXC,OAAQ,CACJD,MAAO,OAMvBE,uBAEW,EAGXC,yBACW,QAGXC,sBACWnB,KAAKO,OAAOa,eAGvBC,6BACW,6BAGXC,YAAYC,wBACEA,8DAIJC,oBAAeC,qCACfC,aAAeC,wBAAcC,IAAIJ,cACnCE,oBACOA,aAAaG,aAGlBC,mCAAa,cAAcC,wBACfP,uDACOC,6EAGXO,SAASF,WAAWG,KAAMH,WAAYA,WAAWI,UACxDJ"}
{"version":3,"file":"video_recorder.min.js","sources":["../src/video_recorder.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 <http://www.gnu.org/licenses/>.\n\n/**\n * Tiny Record RTC - Video recorder configuration.\n *\n * @module tiny_recordrtc/video_recorder\n * @copyright 2022 Stevani Andolo <stevani@hotmail.com.au>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport BaseClass from './base_recorder';\nimport Modal from 'tiny_recordrtc/modal';\nimport {component} from 'tiny_recordrtc/common';\n\nexport default class Video extends BaseClass {\n configurePlayer() {\n return this.modalRoot.querySelector('video');\n }\n\n getSupportedTypes() {\n return [\n 'video/webm;codecs=vp9,opus',\n 'video/webm;codecs=h264,opus',\n 'video/webm;codecs=vp8,opus',\n ];\n\n }\n\n getParsedRecordingOptions() {\n return {\n audioBitsPerSecond: parseInt(this.config.audiobitrate),\n videoBitsPerSecond: parseInt(this.config.videobitrate)\n };\n }\n\n getMediaConstraints() {\n return {\n audio: true,\n video: {\n width: {\n ideal: 640,\n },\n height: {\n ideal: 480,\n },\n },\n };\n }\n\n playOnCapture() {\n // Play the recording back on capture.\n return true;\n }\n\n getRecordingType() {\n return 'video';\n }\n\n getTimeLimit() {\n return this.config.videotimelimit;\n }\n\n getEmbedTemplateName() {\n return 'tiny_recordrtc/embed_video';\n }\n\n getFileName(prefix) {\n return `${prefix}-video.webm`;\n }\n\n static getModalClass() {\n const VideoModal = class extends Modal {\n static TYPE = `${component}/video_recorder`;\n static TEMPLATE = `${component}/video_recorder`;\n };\n\n VideoModal.registerModalType();\n return VideoModal;\n }\n}\n"],"names":["Video","BaseClass","configurePlayer","this","modalRoot","querySelector","getSupportedTypes","getParsedRecordingOptions","audioBitsPerSecond","parseInt","config","audiobitrate","videoBitsPerSecond","videobitrate","getMediaConstraints","audio","video","width","ideal","height","playOnCapture","getRecordingType","getTimeLimit","videotimelimit","getEmbedTemplateName","getFileName","prefix","VideoModal","Modal","component","registerModalType"],"mappings":"8kBA2BqBA,cAAcC,uBAC/BC,yBACWC,KAAKC,UAAUC,cAAc,SAGxCC,0BACW,CACH,6BACA,8BACA,8BAKRC,kCACW,CACHC,mBAAoBC,SAASN,KAAKO,OAAOC,cACzCC,mBAAoBH,SAASN,KAAKO,OAAOG,eAIjDC,4BACW,CACHC,OAAO,EACPC,MAAO,CACHC,MAAO,CACHC,MAAO,KAEXC,OAAQ,CACJD,MAAO,OAMvBE,uBAEW,EAGXC,yBACW,QAGXC,sBACWnB,KAAKO,OAAOa,eAGvBC,6BACW,6BAGXC,YAAYC,wBACEA,8DAIJC,mCAAa,cAAcC,kCACZC,kFACIA,qDAGzBF,WAAWG,oBACJH"}

View File

@ -23,7 +23,6 @@
import BaseClass from './base_recorder';
import Modal from './modal';
import ModalRegistry from 'core/modal_registry';
import {component} from 'tiny_recordrtc/common';
export default class Audio extends BaseClass {
@ -67,18 +66,12 @@ export default class Audio extends BaseClass {
}
static getModalClass() {
const modalType = `${component}/audio_recorder`;
const registration = ModalRegistry.get(modalType);
if (registration) {
return registration.module;
}
const AudioModal = class extends Modal {
static TYPE = modalType;
static TYPE = `${component}/audio_recorder`;
static TEMPLATE = `${component}/audio_recorder`;
};
ModalRegistry.register(AudioModal.TYPE, AudioModal, AudioModal.TEMPLATE);
AudioModal.registerModalType();
return AudioModal;
}
}

View File

@ -23,7 +23,6 @@
import BaseClass from './base_recorder';
import Modal from 'tiny_recordrtc/modal';
import ModalRegistry from 'core/modal_registry';
import {component} from 'tiny_recordrtc/common';
export default class Video extends BaseClass {
@ -83,18 +82,12 @@ export default class Video extends BaseClass {
}
static getModalClass() {
const modalType = `${component}/video_recorder`;
const registration = ModalRegistry.get(modalType);
if (registration) {
return registration.module;
}
const VideoModal = class extends Modal {
static TYPE = modalType;
static TYPE = `${component}/video_recorder`;
static TEMPLATE = `${component}/video_recorder`;
};
ModalRegistry.register(VideoModal.TYPE, VideoModal, VideoModal.TEMPLATE);
VideoModal.registerModalType();
return VideoModal;
}
}

View File

@ -1,10 +1,3 @@
define("core_payment/modal_gateways",["exports","jquery","core/custom_interaction_events","core/modal","core/modal_events","core_payment/events","core/modal_registry"],(function(_exports,_jquery,_custom_interaction_events,_modal,_modal_events,_events,_modal_registry){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}
/**
* Contain the logic for the gateways modal: A modal with proceed and cancel buttons.
*
* @module core_payment/modal_gateways
* @copyright 2020 Shamim Rezaie <shamim@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_jquery=_interopRequireDefault(_jquery),_custom_interaction_events=_interopRequireDefault(_custom_interaction_events),_modal=_interopRequireDefault(_modal),_modal_events=_interopRequireDefault(_modal_events),_events=_interopRequireDefault(_events),_modal_registry=_interopRequireDefault(_modal_registry);let registered=!1;const SELECTORS_PROCEED_BUTTON='[data-action="proceed"]',SELECTORS_CANCEL_BUTTON='[data-action="cancel"]';class ModalGateways extends _modal.default{constructor(root){super(root)}registerEventListeners(){super.registerEventListeners(),this.getModal().on(_custom_interaction_events.default.events.activate,SELECTORS_PROCEED_BUTTON,((e,data)=>{var proceedEvent=_jquery.default.Event(_events.default.proceed);this.getRoot().trigger(proceedEvent,this),proceedEvent.isDefaultPrevented()||(this.hide(),data.originalEvent.preventDefault())})),this.getModal().on(_custom_interaction_events.default.events.activate,SELECTORS_CANCEL_BUTTON,((e,data)=>{var cancelEvent=_jquery.default.Event(_modal_events.default.cancel);this.getRoot().trigger(cancelEvent,this),cancelEvent.isDefaultPrevented()||(this.hide(),data.originalEvent.preventDefault())}))}}return _exports.default=ModalGateways,ModalGateways.TYPE="core_payment-modal_gateways",registered||(_modal_registry.default.register(ModalGateways.TYPE,ModalGateways,"core_payment/modal_gateways"),registered=!0),_exports.default}));
define("core_payment/modal_gateways",["exports","jquery","core/custom_interaction_events","core/modal","core/modal_events","core_payment/events"],(function(_exports,_jquery,_custom_interaction_events,_modal,_modal_events,_events){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_jquery=_interopRequireDefault(_jquery),_custom_interaction_events=_interopRequireDefault(_custom_interaction_events),_modal=_interopRequireDefault(_modal),_modal_events=_interopRequireDefault(_modal_events),_events=_interopRequireDefault(_events);const SELECTORS_PROCEED_BUTTON='[data-action="proceed"]',SELECTORS_CANCEL_BUTTON='[data-action="cancel"]';class ModalGateways extends _modal.default{constructor(root){super(root)}registerEventListeners(){super.registerEventListeners(),this.getModal().on(_custom_interaction_events.default.events.activate,SELECTORS_PROCEED_BUTTON,((e,data)=>{var proceedEvent=_jquery.default.Event(_events.default.proceed);this.getRoot().trigger(proceedEvent,this),proceedEvent.isDefaultPrevented()||(this.hide(),data.originalEvent.preventDefault())})),this.getModal().on(_custom_interaction_events.default.events.activate,SELECTORS_CANCEL_BUTTON,((e,data)=>{var cancelEvent=_jquery.default.Event(_modal_events.default.cancel);this.getRoot().trigger(cancelEvent,this),cancelEvent.isDefaultPrevented()||(this.hide(),data.originalEvent.preventDefault())}))}}return _exports.default=ModalGateways,_defineProperty(ModalGateways,"TYPE","core_payment-modal_gateways"),_defineProperty(ModalGateways,"TEMPLATE","core_payment/modal_gateways"),ModalGateways.registerModalType(),_exports.default}));
//# sourceMappingURL=modal_gateways.min.js.map

View File

@ -1 +1 @@
{"version":3,"file":"modal_gateways.min.js","sources":["../src/modal_gateways.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 <http://www.gnu.org/licenses/>.\n\n/**\n * Contain the logic for the gateways modal: A modal with proceed and cancel buttons.\n *\n * @module core_payment/modal_gateways\n * @copyright 2020 Shamim Rezaie <shamim@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport $ from 'jquery';\nimport CustomEvents from 'core/custom_interaction_events';\nimport Modal from 'core/modal';\nimport ModalEvents from 'core/modal_events';\nimport PaymentEvents from 'core_payment/events';\nimport ModalRegistry from 'core/modal_registry';\n\nlet registered = false;\nconst SELECTORS = {\n PROCEED_BUTTON: '[data-action=\"proceed\"]',\n CANCEL_BUTTON: '[data-action=\"cancel\"]',\n};\n\nexport default class ModalGateways extends Modal {\n\n /**\n * Constructor for the Modal.\n *\n * @param {object} root The root jQuery element for the modal\n */\n constructor(root) {\n super(root);\n }\n\n /**\n * Set up all of the event handling for the modal.\n *\n * @method registerEventListeners\n */\n registerEventListeners() {\n // Apply parent event listeners.\n super.registerEventListeners();\n\n this.getModal().on(CustomEvents.events.activate, SELECTORS.PROCEED_BUTTON, (e, data) => {\n var proceedEvent = $.Event(PaymentEvents.proceed);\n this.getRoot().trigger(proceedEvent, this);\n\n if (!proceedEvent.isDefaultPrevented()) {\n this.hide();\n data.originalEvent.preventDefault();\n }\n });\n\n this.getModal().on(CustomEvents.events.activate, SELECTORS.CANCEL_BUTTON, (e, data) => {\n var cancelEvent = $.Event(ModalEvents.cancel);\n this.getRoot().trigger(cancelEvent, this);\n\n if (!cancelEvent.isDefaultPrevented()) {\n this.hide();\n data.originalEvent.preventDefault();\n }\n });\n }\n}\n\nModalGateways.TYPE = 'core_payment-modal_gateways';\n\n// Automatically register with the modal registry the first time this module is imported so that you can create modals\n// of this type using the modal factory.\nif (!registered) {\n ModalRegistry.register(ModalGateways.TYPE, ModalGateways, 'core_payment/modal_gateways');\n registered = true;\n}\n"],"names":["registered","SELECTORS","ModalGateways","Modal","constructor","root","registerEventListeners","getModal","on","CustomEvents","events","activate","e","data","proceedEvent","$","Event","PaymentEvents","proceed","getRoot","trigger","this","isDefaultPrevented","hide","originalEvent","preventDefault","cancelEvent","ModalEvents","cancel","TYPE","register"],"mappings":";;;;;;;yYA8BIA,YAAa,QACXC,yBACc,0BADdA,wBAEa,+BAGEC,sBAAsBC,eAOvCC,YAAYC,YACFA,MAQVC,+BAEUA,8BAEDC,WAAWC,GAAGC,mCAAaC,OAAOC,SAAUV,0BAA0B,CAACW,EAAGC,YACvEC,aAAeC,gBAAEC,MAAMC,gBAAcC,cACpCC,UAAUC,QAAQN,aAAcO,MAEhCP,aAAaQ,4BACTC,OACLV,KAAKW,cAAcC,0BAItBlB,WAAWC,GAAGC,mCAAaC,OAAOC,SAAUV,yBAAyB,CAACW,EAAGC,YACtEa,YAAcX,gBAAEC,MAAMW,sBAAYC,aACjCT,UAAUC,QAAQM,YAAaL,MAE/BK,YAAYJ,4BACRC,OACLV,KAAKW,cAAcC,4DAMnCvB,cAAc2B,KAAO,8BAIhB7B,qCACa8B,SAAS5B,cAAc2B,KAAM3B,cAAe,+BAC1DF,YAAa"}
{"version":3,"file":"modal_gateways.min.js","sources":["../src/modal_gateways.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 <http://www.gnu.org/licenses/>.\n\n/**\n * Contain the logic for the gateways modal: A modal with proceed and cancel buttons.\n *\n * @module core_payment/modal_gateways\n * @copyright 2020 Shamim Rezaie <shamim@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport $ from 'jquery';\nimport CustomEvents from 'core/custom_interaction_events';\nimport Modal from 'core/modal';\nimport ModalEvents from 'core/modal_events';\nimport PaymentEvents from 'core_payment/events';\n\nconst SELECTORS = {\n PROCEED_BUTTON: '[data-action=\"proceed\"]',\n CANCEL_BUTTON: '[data-action=\"cancel\"]',\n};\n\nexport default class ModalGateways extends Modal {\n static TYPE = 'core_payment-modal_gateways';\n static TEMPLATE = 'core_payment/modal_gateways';\n\n /**\n * Constructor for the Modal.\n *\n * @param {object} root The root jQuery element for the modal\n */\n constructor(root) {\n super(root);\n }\n\n /**\n * Set up all of the event handling for the modal.\n *\n * @method registerEventListeners\n */\n registerEventListeners() {\n // Apply parent event listeners.\n super.registerEventListeners();\n\n this.getModal().on(CustomEvents.events.activate, SELECTORS.PROCEED_BUTTON, (e, data) => {\n var proceedEvent = $.Event(PaymentEvents.proceed);\n this.getRoot().trigger(proceedEvent, this);\n\n if (!proceedEvent.isDefaultPrevented()) {\n this.hide();\n data.originalEvent.preventDefault();\n }\n });\n\n this.getModal().on(CustomEvents.events.activate, SELECTORS.CANCEL_BUTTON, (e, data) => {\n var cancelEvent = $.Event(ModalEvents.cancel);\n this.getRoot().trigger(cancelEvent, this);\n\n if (!cancelEvent.isDefaultPrevented()) {\n this.hide();\n data.originalEvent.preventDefault();\n }\n });\n }\n}\n\nModalGateways.registerModalType();\n"],"names":["SELECTORS","ModalGateways","Modal","constructor","root","registerEventListeners","getModal","on","CustomEvents","events","activate","e","data","proceedEvent","$","Event","PaymentEvents","proceed","getRoot","trigger","this","isDefaultPrevented","hide","originalEvent","preventDefault","cancelEvent","ModalEvents","cancel","registerModalType"],"mappings":"0yBA6BMA,yBACc,0BADdA,wBAEa,+BAGEC,sBAAsBC,eASvCC,YAAYC,YACFA,MAQVC,+BAEUA,8BAEDC,WAAWC,GAAGC,mCAAaC,OAAOC,SAAUV,0BAA0B,CAACW,EAAGC,YACvEC,aAAeC,gBAAEC,MAAMC,gBAAcC,cACpCC,UAAUC,QAAQN,aAAcO,MAEhCP,aAAaQ,4BACTC,OACLV,KAAKW,cAAcC,0BAItBlB,WAAWC,GAAGC,mCAAaC,OAAOC,SAAUV,yBAAyB,CAACW,EAAGC,YACtEa,YAAcX,gBAAEC,MAAMW,sBAAYC,aACjCT,UAAUC,QAAQM,YAAaL,MAE/BK,YAAYJ,4BACRC,OACLV,KAAKW,cAAcC,4EAtCdvB,qBACH,+CADGA,yBAEC,+BA0CtBA,cAAc2B"}

View File

@ -26,15 +26,15 @@ import CustomEvents from 'core/custom_interaction_events';
import Modal from 'core/modal';
import ModalEvents from 'core/modal_events';
import PaymentEvents from 'core_payment/events';
import ModalRegistry from 'core/modal_registry';
let registered = false;
const SELECTORS = {
PROCEED_BUTTON: '[data-action="proceed"]',
CANCEL_BUTTON: '[data-action="cancel"]',
};
export default class ModalGateways extends Modal {
static TYPE = 'core_payment-modal_gateways';
static TEMPLATE = 'core_payment/modal_gateways';
/**
* Constructor for the Modal.
@ -76,11 +76,4 @@ export default class ModalGateways extends Modal {
}
}
ModalGateways.TYPE = 'core_payment-modal_gateways';
// Automatically register with the modal registry the first time this module is imported so that you can create modals
// of this type using the modal factory.
if (!registered) {
ModalRegistry.register(ModalGateways.TYPE, ModalGateways, 'core_payment/modal_gateways');
registered = true;
}
ModalGateways.registerModalType();