diff --git a/static/js/browser.js b/static/js/browser.js index 7cf0368..925bc18 100644 --- a/static/js/browser.js +++ b/static/js/browser.js @@ -80,8 +80,9 @@ oml.ui.browser = function() { }) .bindEvent({ key_control_delete: function() { - var listData = oml.getListData(); - if (listData.own) { + if (that.value( + that.options('selected')[0], 'mediastate' + ) == 'available') { oml.ui.deleteItemsDialog().open(); } }, @@ -100,12 +101,22 @@ oml.ui.browser = function() { }); } else { // no longer in context after edit - oml.stayInItemView = true; - oml.UI.set({ - find: {conditions: [], operator: '&'}, - listSelection: [ui.item] + oml.api.find({ + query: {conditions: [], operator: '&'}, + positions: [ui.item] + }, function(result) { + if (result.data.positions[ui.item] === void 0) { + // no longer in libraries after delete + oml.UI.set({item: ''}); + } else { + oml.stayInItemView = true; + oml.UI.set({ + find: {conditions: [], operator: '&'}, + listSelection: [ui.item] + }); + oml.stayInItemView = false; + } }); - oml.stayInItemView = false; } } },