JI-1285 Set empty XAPIEvent object when instance has no contentId

Content types view always expect to have a contentId when they are displayed. This is no the case if they are displayed in the editor as part of a preview. The fix is to set an empty object with definition for the xAPI event, so all the content types that rely on this does not have to be rewritten. This means that content types that are being previewed will send xAPI completed events, but since there are no scripts that catch these events in the editor, this is not a problem.
HFP-2862-fix-download-warning
Thomas Marstrander 2019-09-10 13:42:18 +02:00 committed by Paal Joergensen
parent 7bc8666f30
commit 7a8f894c85
1 changed files with 6 additions and 0 deletions

View File

@ -141,6 +141,12 @@ H5P.XAPIEvent.prototype.setObject = function (instance) {
}
}
}
else {
// Empty object
this.data.statement.object = {
definition: {}
};
}
};
/**