Proyectos de Subversion Moodle

Rev

Rev 1 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
// This file is part of Moodle - http://moodle.org/
2
//
3
// Moodle is free software: you can redistribute it and/or modify
4
// it under the terms of the GNU General Public License as published by
5
// the Free Software Foundation, either version 3 of the License, or
6
// (at your option) any later version.
7
//
8
// Moodle is distributed in the hope that it will be useful,
9
// but WITHOUT ANY WARRANTY; without even the implied warranty of
10
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
// GNU General Public License for more details.
12
//
13
// You should have received a copy of the GNU General Public License
14
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
15
 
16
/**
17
 * Tiny Record RTC plugin for Moodle.
18
 *
19
 * @module      tiny_recordrtc/plugin
20
 * @copyright   2022, Stevani Andolo <stevani@hotmail.com.au>
21
 * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
22
 */
23
import {getTinyMCE} from 'editor_tiny/loader';
24
import {getPluginMetadata} from 'editor_tiny/utils';
25
import getSetupAudioCommands from './commands_audio';
26
import getSetupVideoCommands from './commands_video';
1441 ariadna 27
import getSetupScreenCommands from './commands_screen';
28
import getSetupVideoContextMenuCommands from './commands_video_context_menu';
1 efrain 29
import * as Configuration from './configuration';
30
import * as Options from './options';
31
import {
32
    component,
33
    pluginName
34
} from './common';
35
 
36
// eslint-disable-next-line no-async-promise-executor
37
export default new Promise(async(resolve) => {
38
    const [
39
        tinyMCE,
40
        setupAudioCommands,
41
        setupVideoCommands,
1441 ariadna 42
        setupScreenCommands,
43
        setupVideoContextMenuCommands,
1 efrain 44
        pluginMetadata,
45
    ] = await Promise.all([
46
        getTinyMCE(),
47
        getSetupAudioCommands(),
48
        getSetupVideoCommands(),
1441 ariadna 49
        getSetupScreenCommands(),
50
        getSetupVideoContextMenuCommands(),
1 efrain 51
        getPluginMetadata(component, pluginName),
52
    ]);
53
 
54
    tinyMCE.PluginManager.add(`${component}/plugin`, (editor) => {
55
        // Register options.
56
        Options.register(editor);
57
 
58
        // Setup the Commands (buttons, menu items, and so on) for video.
59
        setupVideoCommands(editor);
60
 
61
        // Setup the Commands (buttons, menu items, and so on) for audio.
62
        setupAudioCommands(editor);
63
 
1441 ariadna 64
        // Setup the Commands (buttons, menu items, and so on) for screen.
65
        setupScreenCommands(editor);
66
 
67
        // Setup the Commands (context menu) for video (recording and screen-sharing).
68
        setupVideoContextMenuCommands(editor);
69
 
1 efrain 70
        return pluginMetadata;
71
    });
72
 
73
    // Resolve the Media Plugin and include configuration.
74
    resolve([`${component}/plugin`, Configuration]);
75
});