forked from h5p/h5p-dialogcards
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupgrades.js
41 lines (37 loc) · 1.11 KB
/
upgrades.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
var H5PUpgrades = H5PUpgrades || {};
H5PUpgrades['H5P.Dialogcards'] = (function () {
return {
1: {
/**
* Asynchronous content upgrade hook.
* Upgrades content parameters to support DQ 1.4.
*
* Converts text and answer into rich text.
* Escapes 'dangerous' symbols.
*
* @param {Object} parameters
* @param {function} finished
*/
4: function (parameters, finished) {
// The old default was to scale the text and not the card
parameters.behaviour = {
scaleTextNotCard: true
};
// Complete
finished(null, parameters);
},
7: function (parameters, finished, extras) {
var extrasOut = extras || {};
// Copy html-free title to new metadata structure if present
var title = parameters.title || ((extras && extras.metadata) ? extras.metadata.title : undefined);
if (title) {
title = title.replace(/<[^>]*>?/g, '');
}
extrasOut.metadata = {
title: title
};
finished(null, parameters, extrasOut);
}
}
};
})();