Skip to content
Snippets Groups Projects
Commit 0dc0727a authored by Frode Petterson's avatar Frode Petterson
Browse files

Merge branch 'master' of github.com:h5p/h5p-moodle-plugin

parents 680faf33 87e21390
No related branches found
No related tags found
No related merge requests found
......@@ -23,8 +23,12 @@
$('input[name="h5paction"]').parents('.fitem').last().hide();
}
const mformId = H5PIntegration.editor && H5PIntegration.editor.formId !== null
? H5PIntegration.editor.formId
: 'mform1';
H5PEditor.init(
$('#mform1'),
$('#' + mformId),
$('input[name="h5paction"]'),
getRow($fileField),
getRow($editor),
......
......@@ -127,8 +127,12 @@ function hvp_get_core_assets($context) {
* Add required assets for displaying the editor.
*
* @param int $id Content being edited. null for creating new content
* @param string $mformid Id of Moodle form
*
* @throws coding_exception
* @throws moodle_exception
*/
function hvp_add_editor_assets($id = null) {
function hvp_add_editor_assets($id = null, $mformid = null) {
global $PAGE, $CFG, $COURSE;
// First we need to determine the context for permission handling.
......@@ -201,6 +205,7 @@ function hvp_add_editor_assets($id = null) {
// @codingStandardsIgnoreLine
'apiVersion' => H5PCore::$coreApi,
'language' => $language,
'formId' => $mformid,
);
if ($id !== null) {
......
......@@ -210,7 +210,8 @@ class mod_hvp_mod_form extends moodleform_mod {
// Add required editor assets.
require_once('locallib.php');
\hvp_add_editor_assets($content === null ? null : $defaultvalues['id']);
$mformid = $this->_form->getAttribute('id');
\hvp_add_editor_assets($content === null ? null : $defaultvalues['id'], $mformid);
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment