diff --git a/js/h5p-x-api-event.js b/js/h5p-x-api-event.js index d2b68be..a26b58b 100644 --- a/js/h5p-x-api-event.js +++ b/js/h5p-x-api-event.js @@ -142,7 +142,13 @@ H5P.XAPIEvent.prototype.setObject = function (instance) { } } else { - // Empty object + // Content types view always expect to have a contentId when they are displayed. + // This is not 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 handle it. 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. this.data.statement.object = { definition: {} };