Creating & Editing H5P Content
Rendering the H5P Editor
To render the editor blank to create new content call the renderEditor
method on the global Lumi (window.Lumi) object with the HTMLElement in which to render as the first argument:
HTMLElement: The HTMLElement where the content should be rendered. For example
document.getElementById('h5peditor')
contentId (optional): the contentId of the content to edit.
options (optional): an object with the following fields:
onEditorLoaded: callback that is called when the editor is loaded. (This will be called as soon as the user has a content type selected from the content selection.)
onEditorSaved: callback that is called when the content is saved. The first argument is the contentId.
onEditorSaveError: callback that is called when there was an error while saving the content.
The most basic editor can be rendered with:
Saving H5P content
To save the content call the saveEditor
-method on the global Lumi (window.Lumi) object:
Codepen example
Editing existing H5P Content
To edit existing content you need to pass the contentId as second argument to the renderEditor
-method:
To save the edited content see Saving H5P Content.
Last updated