Proyectos de Subversion Moodle

Rev

Autoría | Ultima modificación | Ver Log |

{"version":3,"file":"configuration.min.js","sources":["../src/configuration.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 * Tiny Record RTC configuration.\n *\n * @module      tiny_recordrtc/configuration\n * @copyright   2022, Stevani Andolo <stevani@hotmail.com.au>\n * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {\n    audioButtonName,\n    videoButtonName\n} from './common';\nimport {\n    addMenubarItem,\n} from 'editor_tiny/utils';\n\nconst configureMenu = (menu) => {\n    const items = menu.insert.items.split(' ');\n    const inserted = items.some((item, index) => {\n        // Append after the media or video button.\n        if (item.match(/(media|video)\\b/)) {\n            items.splice(index + 1, 0, audioButtonName, videoButtonName);\n            return true;\n        }\n\n        return false;\n    });\n\n    if (inserted) {\n        menu.insert.items = items.join(' ');\n    } else {\n        addMenubarItem(menu, 'insert', `${audioButtonName} ${videoButtonName}`);\n    }\n\n    return menu;\n};\n\nconst configureToolbar = (toolbar) => {\n    // The toolbar contains an array of named sections.\n    // The Moodle integration ensures that there is a section called 'content'.\n\n\n    return toolbar.map((section) => {\n        if (section.name === 'content') {\n            const inserted = section.items.some((item, index) => {\n                // Append after the media or video button.\n                if (item.match(/(media|video)\\b/)) {\n                    section.items.splice(index + 1, 0, audioButtonName, videoButtonName);\n                    return true;\n                }\n                return false;\n            });\n\n            if (!inserted) {\n                section.items.unshift(audioButtonName, videoButtonName);\n            }\n        }\n\n        return section;\n    });\n};\n\nexport const configure = (instanceConfig) => {\n    // Update the instance configuration to add the Media menu option to the menus and toolbars and upload_handler.\n    return {\n        toolbar: configureToolbar(instanceConfig.toolbar),\n        menu: configureMenu(instanceConfig.menu),\n    };\n};\n"],"names":["configureMenu","menu","items","insert","split","some","item","index","match","splice","audioButtonName","videoButtonName","join","instanceConfig","toolbar","map","section","name","unshift"],"mappings":";;;;;;;;MA+BMA,cAAiBC,aACbC,MAAQD,KAAKE,OAAOD,MAAME,MAAM,YACrBF,MAAMG,MAAK,CAACC,KAAMC,UAE3BD,KAAKE,MAAM,qBACXN,MAAMO,OAAOF,MAAQ,EAAG,EAAGG,wBAAiBC,0BACrC,KAOXV,KAAKE,OAAOD,MAAQA,MAAMU,KAAK,+BAEhBX,KAAM,mBAAaS,oCAAmBC,0BAGlDV,yBA4BeY,uBAEf,CACHC,SA5BkBA,QA4BQD,eAAeC,QAvBtCA,QAAQC,KAAKC,UACK,YAAjBA,QAAQC,OACSD,QAAQd,MAAMG,MAAK,CAACC,KAAMC,UAEnCD,KAAKE,MAAM,qBACXQ,QAAQd,MAAMO,OAAOF,MAAQ,EAAG,EAAGG,wBAAiBC,0BAC7C,MAMXK,QAAQd,MAAMgB,QAAQR,wBAAiBC,0BAIxCK,YAQPf,KAAMD,cAAca,eAAeZ,OA7BjBa,IAAAA"}