mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 01:16:44 +02:00
MDL-67814 core_h5p: added renderer and editor classes
This commit is contained in:
parent
8c325d3feb
commit
eeb90e7e70
9 changed files with 936 additions and 96 deletions
2
h5p/amd/build/editor_display.min.js
vendored
Normal file
2
h5p/amd/build/editor_display.min.js
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
define ("core_h5p/editor_display",["exports","jquery"],function(a,b){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.init=void 0;b=function(a){return a&&a.__esModule?a:{default:a}}(b);var c=function(a){var c=(0,b.default)("#"+a),d=(0,b.default)(".h5p-editor"),e=d.closest("form"),f=(0,b.default)("h5p-editor-upload"),g=(0,b.default)("input[name=\"h5plibrary\"]"),h=(0,b.default)("input[name=\"h5pparams\"]"),i=(0,b.default)("input[name=\"name\"]"),j=(0,b.default)("input[name=\"h5paction\"]");j.val("create");H5PEditor.init(e,j,f,c,d,g,h,"",i,function cancelSubmitCallback(a){return a.is("[name=\"cancel\"]")})};a.init=c});
|
||||
//# sourceMappingURL=editor_display.min.js.map
|
1
h5p/amd/build/editor_display.min.js.map
Normal file
1
h5p/amd/build/editor_display.min.js.map
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../src/editor_display.js"],"names":["init","elementId","editorwrapper","editor","mform","closest","editorupload","h5plibrary","h5pparams","inputname","h5paction","val","H5PEditor","cancelSubmitCallback","$button","is"],"mappings":"iJAwBA,uDAOO,GAAMA,CAAAA,CAAI,CAAG,SAACC,CAAD,CAAe,IACzBC,CAAAA,CAAa,CAAG,cAAE,IAAMD,CAAR,CADS,CAEzBE,CAAM,CAAG,cAAE,aAAF,CAFgB,CAGzBC,CAAK,CAAGD,CAAM,CAACE,OAAP,CAAe,MAAf,CAHiB,CAIzBC,CAAY,CAAG,cAAE,mBAAF,CAJU,CAKzBC,CAAU,CAAG,cAAE,4BAAF,CALY,CAMzBC,CAAS,CAAG,cAAE,2BAAF,CANa,CAOzBC,CAAS,CAAG,cAAE,sBAAF,CAPa,CAQzBC,CAAS,CAAG,cAAE,2BAAF,CARa,CAe/BA,CAAS,CAACC,GAAV,CAAc,QAAd,EAEAC,SAAS,CAACZ,IAAV,CACII,CADJ,CAEIM,CAFJ,CAGIJ,CAHJ,CAIIJ,CAJJ,CAKIC,CALJ,CAMII,CANJ,CAOIC,CAPJ,CAQI,EARJ,CASIC,CATJ,CAN6B,QAAvBI,CAAAA,oBAAuB,CAASC,CAAT,CAAkB,CAC3C,MAAOA,CAAAA,CAAO,CAACC,EAAR,CAAW,mBAAX,CACV,CAID,CAYH,CA7BM,C","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 * This module handles the display of the H5P authoring tool.\n *\n * @module core_h5p/editor_display\n * @package core_h5p\n * @copyright 2020 Victor Deniz <victor@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport $ from 'jquery';\n\n/**\n * Display the H5P authoring tool.\n *\n * @param {String} elementId Root element.\n */\nexport const init = (elementId) => {\n const editorwrapper = $('#' + elementId);\n const editor = $('.h5p-editor');\n const mform = editor.closest(\"form\");\n const editorupload = $(\"h5p-editor-upload\");\n const h5plibrary = $('input[name=\"h5plibrary\"]');\n const h5pparams = $('input[name=\"h5pparams\"]');\n const inputname = $('input[name=\"name\"]');\n const h5paction = $('input[name=\"h5paction\"]');\n\n // Cancel validation and submission of form if clicking cancel button.\n const cancelSubmitCallback = function($button) {\n return $button.is('[name=\"cancel\"]');\n };\n\n h5paction.val(\"create\");\n\n H5PEditor.init(\n mform,\n h5paction,\n editorupload,\n editorwrapper,\n editor,\n h5plibrary,\n h5pparams,\n '',\n inputname,\n cancelSubmitCallback\n );\n};\n"],"file":"editor_display.min.js"}
|
61
h5p/amd/src/editor_display.js
Normal file
61
h5p/amd/src/editor_display.js
Normal file
|
@ -0,0 +1,61 @@
|
|||
// 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/>.
|
||||
|
||||
/**
|
||||
* This module handles the display of the H5P authoring tool.
|
||||
*
|
||||
* @module core_h5p/editor_display
|
||||
* @package core_h5p
|
||||
* @copyright 2020 Victor Deniz <victor@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
import $ from 'jquery';
|
||||
|
||||
/**
|
||||
* Display the H5P authoring tool.
|
||||
*
|
||||
* @param {String} elementId Root element.
|
||||
*/
|
||||
export const init = (elementId) => {
|
||||
const editorwrapper = $('#' + elementId);
|
||||
const editor = $('.h5p-editor');
|
||||
const mform = editor.closest("form");
|
||||
const editorupload = $("h5p-editor-upload");
|
||||
const h5plibrary = $('input[name="h5plibrary"]');
|
||||
const h5pparams = $('input[name="h5pparams"]');
|
||||
const inputname = $('input[name="name"]');
|
||||
const h5paction = $('input[name="h5paction"]');
|
||||
|
||||
// Cancel validation and submission of form if clicking cancel button.
|
||||
const cancelSubmitCallback = function($button) {
|
||||
return $button.is('[name="cancel"]');
|
||||
};
|
||||
|
||||
h5paction.val("create");
|
||||
|
||||
H5PEditor.init(
|
||||
mform,
|
||||
h5paction,
|
||||
editorupload,
|
||||
editorwrapper,
|
||||
editor,
|
||||
h5plibrary,
|
||||
h5pparams,
|
||||
'',
|
||||
inputname,
|
||||
cancelSubmitCallback
|
||||
);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue