Proyectos de Subversion Moodle

Rev

Rev 1 | Autoría | Comparar con el anterior | 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    screenButtonName,\n    videoContextMenuName,\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, screenButtonName);\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} ${screenButtonName}`);\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, videoContextMenuName);\n                    return true;\n                }\n                return false;\n            });\n\n            if (!inserted) {\n                section.items.unshift(audioButtonName, videoContextMenuName);\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","screenButtonName","join","instanceConfig","toolbar","map","section","name","videoContextMenuName","unshift"],"mappings":";;;;;;;;MAiCMA,cAAiBC,aACbC,MAAQD,KAAKE,OAAOD,MAAME,MAAM,YACrBF,MAAMG,MAAK,CAACC,KAAMC,UAE3BD,KAAKE,MAAM,qBACXN,MAAMO,OAAOF,MAAQ,EAAG,EAAGG,wBAAiBC,wBAAiBC,2BACtD,KAOXX,KAAKE,OAAOD,MAAQA,MAAMW,KAAK,+BAEhBZ,KAAM,mBAAaS,oCAAmBC,oCAAmBC,2BAGrEX,yBA4Bea,uBAEf,CACHC,SA5BkBA,QA4BQD,eAAeC,QAvBtCA,QAAQC,KAAKC,UACK,YAAjBA,QAAQC,OACSD,QAAQf,MAAMG,MAAK,CAACC,KAAMC,UAEnCD,KAAKE,MAAM,qBACXS,QAAQf,MAAMO,OAAOF,MAAQ,EAAG,EAAGG,wBAAiBS,+BAC7C,MAMXF,QAAQf,MAAMkB,QAAQV,wBAAiBS,+BAIxCF,YAQPhB,KAAMD,cAAcc,eAAeb,OA7BjBc,IAAAA"}