1441 |
ariadna |
1 |
{"version":3,"file":"textmodal.min.js","sources":["../src/textmodal.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 * AI text modal for Tiny.\n *\n * @module tiny_aiplacement/textmodal\n * @copyright 2024 Matt Porritt <matt.porritt@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Modal from 'core/modal';\nimport ModalEvents from 'core/modal_events';\n\nexport default class TextModal extends Modal {\n static TYPE = 'tiny_aiplacement/textmodal';\n static TEMPLATE = 'tiny_aiplacement/textmodal';\n\n /**\n * Register 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 this.getRoot().on(ModalEvents.outsideClick, (e) => {\n // Prevent closing the modal when clicking outside of it.\n e.preventDefault();\n });\n }\n\n /**\n * Configure the modal.\n *\n * @param {object} modalConfig The modal configuration.\n */\n configure(modalConfig) {\n super.configure({\n ...modalConfig,\n show: true,\n removeOnClose: true,\n });\n\n // Add modal extra class.\n this.getModal().addClass('tiny_aiplacement_modal');\n this.setXlarge();\n }\n\n /**\n * Set the modal to be extra large.\n */\n setXlarge() {\n this.getModal().addClass('modal-xl');\n }\n}\n"],"names":["TextModal","Modal","registerEventListeners","registerCloseOnSave","registerCloseOnCancel","getRoot","on","ModalEvents","outsideClick","e","preventDefault","configure","modalConfig","show","removeOnClose","getModal","addClass","setXlarge"],"mappings":"giBA0BqBA,kBAAkBC,eAOnCC,+BAEUA,8BAGDC,2BACAC,6BAEAC,UAAUC,GAAGC,sBAAYC,cAAeC,IAEzCA,EAAEC,oBASVC,UAAUC,mBACAD,UAAU,IACTC,YACHC,MAAM,EACNC,eAAe,SAIdC,WAAWC,SAAS,+BACpBC,YAMTA,iBACSF,WAAWC,SAAS,+DA1CZhB,iBACH,8CADGA,qBAEC"}
|