HEX
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/8.0.30
System: Linux multiplicar 3.10.0-1160.102.1.el7.x86_64 #1 SMP Tue Oct 17 15:42:21 UTC 2023 x86_64
User: root (0)
PHP: 8.0.30
Disabled: NONE
Upload Files
File: /var/www/html/elearningbasa.sumar.com.py/lib/amd/build/modal_copy_to_clipboard.min.js.map
{"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"}