Proyectos de Subversion Moodle

Rev

Rev 1 | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |

{"version":3,"file":"commands.min.js","sources":["../src/commands.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\nimport {getButtonImage} from 'editor_tiny/utils';\nimport {get_string as getString} from 'core/str';\nimport {component, buttonName, buttonIcon} from 'tiny_noautolink/common';\nimport {handleAction, toggleActiveState} from 'tiny_noautolink/noautolink';\n\n/**\n * Tiny noautolink commands.\n *\n * @module      tiny_noautolink/commands\n * @copyright   2023 Meirza <meirza.arson@moodle.com>\n * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nexport const getSetup = async() => {\n    const [\n        buttonText,\n        infoEmptySelection,\n        infoAddSuccess,\n        infoRemoveSuccess,\n        buttonImage,\n    ] = await Promise.all([\n        getString('buttontitle', component),\n        getString('infoemptyselection', component),\n        getString('infoaddsuccess', component),\n        getString('inforemovesuccess', component),\n        getButtonImage('icon', component),\n    ]);\n\n    return (editor) => {\n\n        const messages = {\n            infoEmptySelection: infoEmptySelection,\n            infoAddSuccess: infoAddSuccess,\n            infoRemoveSuccess: infoRemoveSuccess\n        };\n\n        // Register the noautolink Icon.\n        editor.ui.registry.addIcon(buttonIcon, buttonImage.html);\n\n        // Register the noautolink button.\n        editor.ui.registry.addToggleButton(buttonName, {\n            icon: buttonIcon,\n            tooltip: buttonText,\n            onAction: () => {\n                handleAction(editor, messages);\n            },\n            onSetup: toggleActiveState(editor),\n        });\n\n        // Register the noautolink item.\n        editor.ui.registry.addMenuItem(buttonName, {\n            icon: buttonIcon,\n            text: buttonText,\n            onAction: () => {\n                handleAction(editor, messages);\n            },\n        });\n    };\n};\n"],"names":["async","buttonText","infoEmptySelection","infoAddSuccess","infoRemoveSuccess","buttonImage","Promise","all","component","editor","messages","ui","registry","addIcon","buttonIcon","html","addToggleButton","buttonName","icon","tooltip","onAction","onSetup","addMenuItem","text"],"mappings":"0RA4BwBA,gBAEhBC,WACAC,mBACAC,eACAC,kBACAC,mBACMC,QAAQC,IAAI,EAClB,mBAAU,cAAeC,oBACzB,mBAAU,qBAAsBA,oBAChC,mBAAU,iBAAkBA,oBAC5B,mBAAU,oBAAqBA,oBAC/B,yBAAe,OAAQA,4BAGnBC,eAEEC,SAAW,CACbR,mBAAoBA,mBACpBC,eAAgBA,eAChBC,kBAAmBA,mBAIvBK,OAAOE,GAAGC,SAASC,QAAQC,mBAAYT,YAAYU,MAGnDN,OAAOE,GAAGC,SAASI,gBAAgBC,mBAAY,CAC3CC,KAAMJ,mBACNK,QAASlB,WACTmB,SAAU,kCACOX,OAAQC,WAEzBW,SAAS,iCAAkBZ,UAI/BA,OAAOE,GAAGC,SAASU,YAAYL,mBAAY,CACvCC,KAAMJ,mBACNS,KAAMtB,WACNmB,SAAU,kCACOX,OAAQC"}