Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support media input #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions scripts/mark-the-words.js
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,27 @@ H5P.MarkTheWords = (function ($, Question, Word, KeyboardNav, XapiGenerator) {
* @see {@link https://github.com/h5p/h5p-question/blob/1558b6144333a431dd71e61c7021d0126b18e252/scripts/question.js#L1236|Called from H5P.Question}
*/
MarkTheWords.prototype.registerDomElements = function () {

if (this.params.media && this.params.media.library) {
var type = this.params.media.library.split(' ')[0];
if (type === 'H5P.Image') {
if (this.params.media.params.file) {
// Register task image
this.setImage(this.params.media.params.file.path, {
disableImageZooming: this.params.behaviour.disableImageZooming,
alt: this.params.media.params.alt,
title: this.params.media.params.title
});
}
}
else if (type === 'H5P.Video') {
if (this.params.media.params.sources) {
// Register task video
this.setVideo(this.params.media);
}
}
}

// wrap introduction in div with id
var introduction = '<div id="' + this.introductionId + '">' + this.params.taskDescription + '</div>';

Expand Down
20 changes: 20 additions & 0 deletions semantics.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
[
{
"name": "media",
"type": "group",
"label": "Media",
"importance": "medium",
"fields": [
{
"name": "type",
"type": "library",
"label": "Type",
"importance": "medium",
"options": [
"H5P.Image 1.1",
"H5P.Video 1.5"
],
"optional": true,
"description": "Optional media to display above the question."
}
]
},
{
"label": "Task description",
"importance": "high",
Expand Down