Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 20... Línea 20...
20
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
20
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
21
 * @since      4.0
21
 * @since      4.0
22
 */
22
 */
Línea 23... Línea 23...
23
 
23
 
24
import {dispatchEvent} from 'core/event_dispatcher';
-
 
25
import jQuery from 'jquery';
-
 
Línea 26... Línea 24...
26
import Y from 'core/yui';
24
import {dispatchEvent} from 'core/event_dispatcher';
27
 
25
 
28
/**
26
/**
29
 * Events for the `core_editor` subsystem.
27
 * Events for the `core_editor` subsystem.
Línea 58... Línea 56...
58
        eventTypes.editorContentRestored,
56
        eventTypes.editorContentRestored,
59
        {},
57
        {},
60
        editor || document
58
        editor || document
61
    );
59
    );
62
};
60
};
63
 
-
 
64
let legacyEventsRegistered = false;
-
 
65
if (!legacyEventsRegistered) {
-
 
66
    // The following event triggers are legacy and will be removed in the future.
-
 
67
    // The following approach provides a backwards-compatability layer for the new events.
-
 
68
    // Code should be updated to make use of native events.
-
 
69
 
-
 
70
    Y.use('event', 'moodle-core-event', () => {
-
 
71
        // Provide a backwards-compatability layer for YUI Events.
-
 
72
        document.addEventListener(eventTypes.editorContentRestored, () => {
-
 
73
            // Trigger a legacy AMD event.
-
 
74
            jQuery(document).trigger(M.core.event.EDITOR_CONTENT_RESTORED);
-
 
75
 
-
 
76
            // Trigger a legacy YUI event.
-
 
77
            Y.fire(M.core.event.EDITOR_CONTENT_RESTORED);
-
 
78
        });
-
 
79
    });
-
 
80
 
-
 
81
    legacyEventsRegistered = true;
-
 
82
}
-