From b102a7de21486d23508a9e1790343304a07308b1 Mon Sep 17 00:00:00 2001 From: Thomas Marstrander Date: Tue, 31 May 2016 14:43:12 +0200 Subject: [PATCH] Only add editor context when in editor. HFJ-1972 --- js/h5p.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/js/h5p.js b/js/h5p.js index 95f2caa..71484ae 100644 --- a/js/h5p.js +++ b/js/h5p.js @@ -1799,9 +1799,13 @@ H5P.createTitle = function (rawTitle, maxLength) { data: (data === null ? 0 : data), preload: (preload ? 1 : 0), invalidate: (invalidate ? 1 : 0), - token: H5PIntegration.tokens.contentUserData, - contextId: H5PIntegration.editor.uploadParams.contextId + token: H5PIntegration.tokens.contentUserData }; + + // Set editor context + if (H5PIntegration.editor && H5PIntegration.editor.uploadParams) { + options.data.contextId = H5PIntegration.editor.uploadParams.contextId; + } } else { options.type = 'GET';