mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-04-05 21:01:35 +08:00
fix for CPF when other scripts are also adding to sessionStorage (#8404)
This commit is contained in:
parent
c62203116f
commit
868ce12ad6
@ -5,7 +5,7 @@ namespace Orchard.ContentPicker {
|
||||
public void BuildManifests(ResourceManifestBuilder builder) {
|
||||
var manifest = builder.Add();
|
||||
manifest.DefineScript("ContentPicker").SetUrl("ContentPicker.js", "ContentPicker.js").SetDependencies("jQuery");
|
||||
manifest.DefineScript("SelectableContentTab").SetUrl("SelectableContentTab.js", "SelectableContentTab.js").SetDependencies("jQuery");
|
||||
manifest.DefineScript("SelectableContentTab").SetUrl("SelectableContentTab.js?v=1.1", "SelectableContentTab.js?v=1.1").SetDependencies("jQuery");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,8 +32,13 @@
|
||||
$('.button.addSelected').on('click', function () {
|
||||
var itemsToAdd = new Array();
|
||||
for (var i = 0; i < sessionStorage.length; i++) {
|
||||
var data = window.sessionStorage.getItem(sessionStorage.key(i));
|
||||
itemsToAdd.push(JSON.parse(data));
|
||||
var key = sessionStorage.key(i);
|
||||
// only add the item if the key is an integer: other scripts may be
|
||||
// adding stuff to sessionStorage
|
||||
if (!isNaN(key - parseInt(key))) {
|
||||
var data = window.sessionStorage.getItem(sessionStorage.key(i));
|
||||
itemsToAdd.push(JSON.parse(data));
|
||||
}
|
||||
}
|
||||
window.sessionStorage.clear();
|
||||
window.opener.jQuery[query("callback")](itemsToAdd);
|
||||
|
Loading…
Reference in New Issue
Block a user