Proyectos de Subversion Moodle

Rev

Autoría | 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 {getString} from 'core/str';\nimport {component, linkButtonShortName, unlinkButtonShortName} from 'tiny_link/common';\nimport {handleAction} from 'tiny_link/ui';\nimport {toggleActiveState} from 'tiny_link/link';\n\n/**\n * Tiny Link commands.\n *\n * @module      tiny_link/commands\n * @copyright   2023 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        linkButtonText,\n        unlinkButtonText,\n    ] = await Promise.all([\n        getString('link', component),\n        getString('unlink', component),\n    ]);\n\n    return (editor) => {\n        // Register Link button.\n        editor.ui.registry.addToggleButton(linkButtonShortName, {\n            icon: 'link',\n            tooltip: linkButtonText,\n            onAction: () => {\n                handleAction(editor);\n            },\n            onSetup: toggleActiveState(editor),\n        });\n\n        // Register the Link menu item.\n        editor.ui.registry.addMenuItem(linkButtonShortName, {\n            icon: 'link',\n            shortcut: 'Meta+K',\n            text: linkButtonText,\n            onAction: () => {\n                handleAction(editor);\n            },\n        });\n\n        // Register Unlink button.\n        editor.ui.registry.addToggleButton(unlinkButtonShortName, {\n            icon: 'unlink',\n            tooltip: unlinkButtonText,\n            onAction: () => {\n                handleAction(editor, true);\n            },\n            onSetup: toggleActiveState(editor),\n        });\n\n        // Register shortcut.\n        editor.shortcuts.add('Meta+K', 'Shortcut for create link', () => {\n            handleAction(editor);\n        });\n    };\n};\n"],"names":["async","linkButtonText","unlinkButtonText","Promise","all","component","editor","ui","registry","addToggleButton","linkButtonShortName","icon","tooltip","onAction","onSetup","addMenuItem","shortcut","text","unlinkButtonShortName","shortcuts","add"],"mappings":"oPA4BwBA,gBAEhBC,eACAC,wBACMC,QAAQC,IAAI,EAClB,kBAAU,OAAQC,oBAClB,kBAAU,SAAUA,4BAGhBC,SAEJA,OAAOC,GAAGC,SAASC,gBAAgBC,4BAAqB,CACpDC,KAAM,OACNC,QAASX,eACTY,SAAU,0BACOP,SAEjBQ,SAAS,2BAAkBR,UAI/BA,OAAOC,GAAGC,SAASO,YAAYL,4BAAqB,CAChDC,KAAM,OACNK,SAAU,SACVC,KAAMhB,eACNY,SAAU,0BACOP,WAKrBA,OAAOC,GAAGC,SAASC,gBAAgBS,8BAAuB,CACtDP,KAAM,SACNC,QAASV,iBACTW,SAAU,0BACOP,QAAQ,IAEzBQ,SAAS,2BAAkBR,UAI/BA,OAAOa,UAAUC,IAAI,SAAU,4BAA4B,0BAC1Cd"}