first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
define("core_editor/events",["exports","core/event_dispatcher","jquery","core/yui"],(function(_exports,_event_dispatcher,_jquery,_yui){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}
/**
* Javascript events for the `core_editor` subsystem.
*
* @module core_editor/events
* @copyright 2021 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @since 4.0
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.notifyEditorContentRestored=_exports.eventTypes=void 0,_jquery=_interopRequireDefault(_jquery),_yui=_interopRequireDefault(_yui);const eventTypes={editorContentRestored:"core_editor/contentRestored"};_exports.eventTypes=eventTypes;_exports.notifyEditorContentRestored=editor=>(editor||window.console.warn("The HTMLElement representing the editor that was modified should be provided to notifyEditorContentRestored."),(0,_event_dispatcher.dispatchEvent)(eventTypes.editorContentRestored,{},editor||document));let legacyEventsRegistered=!1;legacyEventsRegistered||(_yui.default.use("event","moodle-core-event",(()=>{document.addEventListener(eventTypes.editorContentRestored,(()=>{(0,_jquery.default)(document).trigger(M.core.event.EDITOR_CONTENT_RESTORED),_yui.default.fire(M.core.event.EDITOR_CONTENT_RESTORED)}))})),legacyEventsRegistered=!0)}));
//# sourceMappingURL=events.min.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"events.min.js","sources":["../src/events.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/ //\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 * Javascript events for the `core_editor` subsystem.\n *\n * @module core_editor/events\n * @copyright 2021 Andrew Nicols <andrew@nicols.co.uk>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n * @since 4.0\n */\n\nimport {dispatchEvent} from 'core/event_dispatcher';\nimport jQuery from 'jquery';\nimport Y from 'core/yui';\n\n/**\n * Events for the `core_editor` subsystem.\n *\n * @constant\n * @property {String} editorContentRestored See {@link event:editorContentRestored}\n */\nexport const eventTypes = {\n /**\n * An event triggered when an editor restores auto-saved content.\n *\n * @event editorContentRestored\n */\n editorContentRestored: 'core_editor/contentRestored',\n};\n\n/**\n * Trigger an event to indicate that editor content was restored.\n *\n * @method notifyEditorContentRestored\n * @param {HTMLElement|null} editor The element that was modified\n * @returns {CustomEvent}\n * @fires editorContentRestored\n */\nexport const notifyEditorContentRestored = editor => {\n if (!editor) {\n window.console.warn(\n `The HTMLElement representing the editor that was modified should be provided to notifyEditorContentRestored.`\n );\n }\n return dispatchEvent(\n eventTypes.editorContentRestored,\n {},\n editor || document\n );\n};\n\nlet legacyEventsRegistered = false;\nif (!legacyEventsRegistered) {\n // The following event triggers are legacy and will be removed in the future.\n // The following approach provides a backwards-compatability layer for the new events.\n // Code should be updated to make use of native events.\n\n Y.use('event', 'moodle-core-event', () => {\n // Provide a backwards-compatability layer for YUI Events.\n document.addEventListener(eventTypes.editorContentRestored, () => {\n // Trigger a legacy AMD event.\n jQuery(document).trigger(M.core.event.EDITOR_CONTENT_RESTORED);\n\n // Trigger a legacy YUI event.\n Y.fire(M.core.event.EDITOR_CONTENT_RESTORED);\n });\n });\n\n legacyEventsRegistered = true;\n}\n"],"names":["eventTypes","editorContentRestored","editor","window","console","warn","document","legacyEventsRegistered","use","addEventListener","trigger","M","core","event","EDITOR_CONTENT_RESTORED","fire"],"mappings":";;;;;;;;6MAiCaA,WAAa,CAMtBC,sBAAuB,mGAWgBC,SAClCA,QACDC,OAAOC,QAAQC,sHAIZ,mCACHL,WAAWC,sBACX,GACAC,QAAUI,eAIdC,wBAAyB,EACxBA,sCAKCC,IAAI,QAAS,qBAAqB,KAEhCF,SAASG,iBAAiBT,WAAWC,uBAAuB,yBAEjDK,UAAUI,QAAQC,EAAEC,KAAKC,MAAMC,sCAGpCC,KAAKJ,EAAEC,KAAKC,MAAMC,+BAI5BP,wBAAyB"}
+82
View File
@@ -0,0 +1,82 @@
// This file is part of Moodle - http://moodle.org/ //
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Javascript events for the `core_editor` subsystem.
*
* @module core_editor/events
* @copyright 2021 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @since 4.0
*/
import {dispatchEvent} from 'core/event_dispatcher';
import jQuery from 'jquery';
import Y from 'core/yui';
/**
* Events for the `core_editor` subsystem.
*
* @constant
* @property {String} editorContentRestored See {@link event:editorContentRestored}
*/
export const eventTypes = {
/**
* An event triggered when an editor restores auto-saved content.
*
* @event editorContentRestored
*/
editorContentRestored: 'core_editor/contentRestored',
};
/**
* Trigger an event to indicate that editor content was restored.
*
* @method notifyEditorContentRestored
* @param {HTMLElement|null} editor The element that was modified
* @returns {CustomEvent}
* @fires editorContentRestored
*/
export const notifyEditorContentRestored = editor => {
if (!editor) {
window.console.warn(
`The HTMLElement representing the editor that was modified should be provided to notifyEditorContentRestored.`
);
}
return dispatchEvent(
eventTypes.editorContentRestored,
{},
editor || document
);
};
let legacyEventsRegistered = false;
if (!legacyEventsRegistered) {
// The following event triggers are legacy and will be removed in the future.
// The following approach provides a backwards-compatability layer for the new events.
// Code should be updated to make use of native events.
Y.use('event', 'moodle-core-event', () => {
// Provide a backwards-compatability layer for YUI Events.
document.addEventListener(eventTypes.editorContentRestored, () => {
// Trigger a legacy AMD event.
jQuery(document).trigger(M.core.event.EDITOR_CONTENT_RESTORED);
// Trigger a legacy YUI event.
Y.fire(M.core.event.EDITOR_CONTENT_RESTORED);
});
});
legacyEventsRegistered = true;
}