Proyectos de Subversion Moodle

Rev

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

{"version":3,"file":"commands_video_context_menu.min.js","sources":["../src/commands_video_context_menu.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 - Video context menu command.\n *\n * @module      tiny_recordrtc/commands_video_context_menu\n * @copyright   2024 The Open University\n * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {getString} from 'core/str';\nimport {getButtonImage} from 'editor_tiny/utils';\nimport {\n    videoButtonName,\n    screenButtonName,\n    videoContextMenuName,\n    component,\n} from './common';\nimport {isVideoAllowed, isScreenAllowed} from './options';\nimport videoRecorder from \"./video_recorder\";\nimport screenRecorder from \"./screen_recorder\";\n\nexport default async() => {\n    const [\n        videoContextMenuTitle,\n        videoButtonTitle,\n        screenButtonTitle,\n        buttonImageVideo,\n        buttonImageScreen,\n    ] = await Promise.all([\n        getString('videorecordmenutitle', component),\n        getString('videobuttontitle', component),\n        getString('screenbuttontitle', component),\n        getButtonImage('video', component),\n        getButtonImage('screen', component),\n    ]);\n\n    return (editor) => {\n        let useContextMenu = true;\n        let singleButton = 'video';\n        let singleButtonTitle = videoButtonTitle;\n        let imageHtml = buttonImageVideo.html;\n        let recorder;\n        if (!isVideoAllowed(editor) && !isScreenAllowed(editor)) {\n            return;\n        } else if (isVideoAllowed(editor) && !isScreenAllowed(editor)) {\n            // Only video recording is allowed.\n            useContextMenu = false;\n            recorder = videoRecorder;\n        } else if (isScreenAllowed(editor) && !isVideoAllowed(editor)) {\n            // Only screen recording is allowed.\n            useContextMenu = false;\n            singleButton = 'screen';\n            singleButtonTitle = screenButtonTitle;\n            imageHtml = buttonImageScreen.html;\n            recorder = screenRecorder;\n        }\n        editor.ui.registry.addIcon(singleButton, imageHtml);\n\n        if (useContextMenu) {\n            // Add the video and screen buttons to the context menu.\n            editor.ui.registry.addMenuButton(videoContextMenuName, {\n                icon: singleButton,\n                tooltip: videoContextMenuTitle,\n                fetch: callback => callback(`${videoButtonName} ${screenButtonName}`),\n            });\n        } else {\n            // Add the video or screen button to the toolbar.\n            editor.ui.registry.addButton(videoContextMenuName, {\n                icon: singleButton,\n                tooltip: singleButtonTitle,\n                onAction: () => recorder.display(editor),\n            });\n        }\n    };\n};\n"],"names":["async","videoContextMenuTitle","videoButtonTitle","screenButtonTitle","buttonImageVideo","buttonImageScreen","Promise","all","component","editor","recorder","useContextMenu","singleButton","singleButtonTitle","imageHtml","html","videoRecorder","screenRecorder","ui","registry","addIcon","addMenuButton","videoContextMenuName","icon","tooltip","fetch","callback","videoButtonName","screenButtonName","addButton","onAction","display"],"mappings":";;;;;;;+NAmCeA,gBAEPC,sBACAC,iBACAC,kBACAC,iBACAC,yBACMC,QAAQC,IAAI,EAClB,kBAAU,uBAAwBC,oBAClC,kBAAU,mBAAoBA,oBAC9B,kBAAU,oBAAqBA,oBAC/B,yBAAe,QAASA,oBACxB,yBAAe,SAAUA,4BAGrBC,aAKAC,SAJAC,gBAAiB,EACjBC,aAAe,QACfC,kBAAoBX,iBACpBY,UAAYV,iBAAiBW,OAE5B,2BAAeN,UAAY,4BAAgBA,YAErC,2BAAeA,WAAY,4BAAgBA,SAElDE,gBAAiB,EACjBD,SAAWM,0BACJ,4BAAgBP,WAAY,2BAAeA,UAElDE,gBAAiB,EACjBC,aAAe,SACfC,kBAAoBV,kBACpBW,UAAYT,kBAAkBU,KAC9BL,SAAWO,0BAEfR,OAAOS,GAAGC,SAASC,QAAQR,aAAcE,WAErCH,eAEAF,OAAOS,GAAGC,SAASE,cAAcC,6BAAsB,CACnDC,KAAMX,aACNY,QAASvB,sBACTwB,MAAOC,UAAYA,mBAAYC,oCAAmBC,6BAItDnB,OAAOS,GAAGC,SAASU,UAAUP,6BAAsB,CAC/CC,KAAMX,aACNY,QAASX,kBACTiB,SAAU,IAAMpB,SAASqB,QAAQtB"}