HFP-2508 Remove caching of pasted content
Objects can not be referenced by multiple widgets when used in the editorcontent-upgrade-on-upload
parent
f19ca76461
commit
9a7a343844
18
js/h5p.js
18
js/h5p.js
|
@ -2207,23 +2207,13 @@ H5P.createTitle = function (rawTitle, maxLength) {
|
|||
H5P.setClipboard(clipboardItem);
|
||||
};
|
||||
|
||||
/**
|
||||
* This is a cache for pasted data to prevent parsing multiple times.
|
||||
* @type {Object}
|
||||
*/
|
||||
var parsedClipboard = null;
|
||||
|
||||
/**
|
||||
* Retrieve parsed clipboard data.
|
||||
*
|
||||
* @return {Object}
|
||||
*/
|
||||
H5P.getClipboard = function () {
|
||||
if (!parsedClipboard) {
|
||||
parsedClipboard = parseClipboard();
|
||||
}
|
||||
|
||||
return parsedClipboard;
|
||||
return parseClipboard();
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -2234,9 +2224,6 @@ H5P.createTitle = function (rawTitle, maxLength) {
|
|||
H5P.setClipboard = function (clipboardItem) {
|
||||
localStorage.setItem('h5pClipboard', JSON.stringify(clipboardItem));
|
||||
|
||||
// Clear cache
|
||||
parsedClipboard = null;
|
||||
|
||||
// Trigger an event so all 'Paste' buttons may be enabled.
|
||||
H5P.externalDispatcher.trigger('datainclipboard', {reset: false});
|
||||
};
|
||||
|
@ -2332,9 +2319,6 @@ H5P.createTitle = function (rawTitle, maxLength) {
|
|||
window.addEventListener('storage', function (event) {
|
||||
// Pick up clipboard changes from other tabs
|
||||
if (event.key === 'h5pClipboard') {
|
||||
// Clear cache
|
||||
parsedClipboard = null;
|
||||
|
||||
// Trigger an event so all 'Paste' buttons may be enabled.
|
||||
H5P.externalDispatcher.trigger('datainclipboard', {reset: event.newValue === null});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue