mirror of
https://github.com/zotero/zotero.git
synced 2026-08-28 05:25:31 +00:00
DataTransfer#types: contains() -> includes()
Not sure what this was before, but it's a standard read-only array now. Fixes #4893
This commit is contained in:
parent
a96b7f1b68
commit
f28fa763cc
4 changed files with 7 additions and 7 deletions
|
|
@ -1497,7 +1497,7 @@ var CollectionTree = class CollectionTree extends LibraryTree {
|
|||
// And everything else is a move
|
||||
this.setDropEffect(event, "move");
|
||||
}
|
||||
else if (event.dataTransfer.types.contains("application/x-moz-file")) {
|
||||
else if (event.dataTransfer.types.includes("application/x-moz-file")) {
|
||||
// As of Aug. 2013 nightlies:
|
||||
//
|
||||
// - Setting the dropEffect only works on Linux and OS X.
|
||||
|
|
|
|||
|
|
@ -2122,7 +2122,7 @@ var ItemTree = class ItemTree extends LibraryTree {
|
|||
this.setDropEffect(event, "copy");
|
||||
}
|
||||
}
|
||||
else if (event.dataTransfer.types.contains("application/x-moz-file")) {
|
||||
else if (event.dataTransfer.types.includes("application/x-moz-file")) {
|
||||
// As of Aug. 2013 nightlies:
|
||||
//
|
||||
// - Setting the dropEffect only works on Linux and OS X.
|
||||
|
|
|
|||
|
|
@ -2035,18 +2035,18 @@ Zotero.DragDrop = {
|
|||
|
||||
var len = firstOnly ? 1 : dt.mozItemCount;
|
||||
|
||||
if (dt.types.contains('zotero/collection')) {
|
||||
if (dt.types.includes('zotero/collection')) {
|
||||
dragData.dataType = 'zotero/collection';
|
||||
let ids = dt.getData('zotero/collection').split(",").map(id => parseInt(id));
|
||||
dragData.data = ids;
|
||||
}
|
||||
else if (dt.types.contains('zotero/item')) {
|
||||
else if (dt.types.includes('zotero/item')) {
|
||||
dragData.dataType = 'zotero/item';
|
||||
let ids = dt.getData('zotero/item').split(",").map(id => parseInt(id));
|
||||
dragData.data = ids;
|
||||
}
|
||||
else {
|
||||
if (dt.types.contains('application/x-moz-file')) {
|
||||
if (dt.types.includes('application/x-moz-file')) {
|
||||
dragData.dataType = 'application/x-moz-file';
|
||||
var files = [];
|
||||
for (var i=0; i<len; i++) {
|
||||
|
|
@ -2065,7 +2065,7 @@ Zotero.DragDrop = {
|
|||
}
|
||||
// This isn't an else because on Linux a link drag contains an empty application/x-moz-file too
|
||||
if (!dragData.data || !dragData.data.length) {
|
||||
if (dt.types.contains('text/x-moz-url')) {
|
||||
if (dt.types.includes('text/x-moz-url')) {
|
||||
dragData.dataType = 'text/x-moz-url';
|
||||
var urls = [];
|
||||
for (var i=0; i<len; i++) {
|
||||
|
|
|
|||
|
|
@ -982,7 +982,7 @@ describe("Zotero.ItemTree", function() {
|
|||
var event = { dataTransfer };
|
||||
// On macOS, ItemTree checks modifier keys, not just the dropEffect
|
||||
if (Zotero.isMac
|
||||
&& dataTransfer.types.contains('application/x-moz-file')) {
|
||||
&& dataTransfer.types.includes('application/x-moz-file')) {
|
||||
switch (dataTransfer.dropEffect) {
|
||||
case 'link':
|
||||
event.metaKey = true;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue