Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
{"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 {getString} from 'core/str';\nimport {component, buttonName, icon} from 'tiny_equation/common';\nimport {handleAction} from 'tiny_equation/ui';\nimport {getSelectedEquation} from 'tiny_equation/equation';\nimport {isTexFilterActive} from 'tiny_equation/options';\n\n/**\n * Tiny Equation commands.\n *\n * @module      tiny_equation/commands\n * @copyright   2022 Huong Nguyen <huongnv13@gmail.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        buttonImage,\n    ] = await Promise.all([\n        getString('buttontitle', component),\n        getButtonImage('icon', component),\n    ]);\n\n    return (editor) => {\n        if (isTexFilterActive(editor)) {\n            // Register the Equation Icon.\n            editor.ui.registry.addIcon(icon, buttonImage.html);\n\n            // Register the Menu Button as a toggle.\n            // This means that when highlighted over an existing Equation element it will show as toggled on.\n            editor.ui.registry.addToggleButton(buttonName, {\n                icon,\n                tooltip: buttonText,\n                onAction: () => {\n                    handleAction(editor);\n                },\n                onSetup: (api) => {\n                    editor.on('NodeChange', () => {\n                        const result = getSelectedEquation(editor);\n                        api.setActive(result);\n                    });\n                },\n            });\n\n            // Add the Equation Menu Item.\n            // This allows it to be added to a standard menu, or a context menu.\n            editor.ui.registry.addMenuItem(buttonName, {\n                icon,\n                text: buttonText,\n                onAction: () => handleAction(editor),\n            });\n        }\n    };\n};\n"],"names":["async","buttonText","buttonImage","Promise","all","component","editor","ui","registry","addIcon","icon","html","addToggleButton","buttonName","tooltip","onAction","onSetup","api","on","result","setActive","addMenuItem","text"],"mappings":"wUA8BwBA,gBAEhBC,WACAC,mBACMC,QAAQC,IAAI,EAClB,kBAAU,cAAeC,oBACzB,yBAAe,OAAQA,4BAGnBC,UACA,8BAAkBA,UAElBA,OAAOC,GAAGC,SAASC,QAAQC,aAAMR,YAAYS,MAI7CL,OAAOC,GAAGC,SAASI,gBAAgBC,mBAAY,CAC3CH,KAAAA,aACAI,QAASb,WACTc,SAAU,0BACOT,SAEjBU,QAAUC,MACNX,OAAOY,GAAG,cAAc,WACdC,QAAS,iCAAoBb,QACnCW,IAAIG,UAAUD,cAO1Bb,OAAOC,GAAGC,SAASa,YAAYR,mBAAY,CACvCH,KAAAA,aACAY,KAAMrB,WACNc,SAAU,KAAM,oBAAaT"}