mirror of
https://github.com/zotero/zotero.git
synced 2026-10-03 02:21:49 +00:00
Make item pane attachments/notes/related item rows draggable (#5184)
This commit is contained in:
parent
3d538d71ca
commit
e6f1983073
4 changed files with 19 additions and 1 deletions
|
|
@ -82,6 +82,7 @@ import { getCSSItemTypeIcon } from 'components/icons';
|
|||
this._removeButton = this.querySelector('.zotero-clicky-minus');
|
||||
|
||||
this._attachmentButton.addEventListener('click', this._handleAttachmentClick);
|
||||
this._attachmentButton.addEventListener('dragstart', this._handleAttachmentDragStart);
|
||||
this._annotationButton.addEventListener('click', this._handleAnnotationClick);
|
||||
|
||||
if (this.editable) {
|
||||
|
|
@ -100,6 +101,10 @@ import { getCSSItemTypeIcon } from 'components/icons';
|
|||
ZoteroPane.viewAttachment(this._attachment.id, event);
|
||||
};
|
||||
|
||||
_handleAttachmentDragStart = (event) => {
|
||||
Zotero.Utilities.Internal.onDragItems(event, [this._attachment.id]);
|
||||
};
|
||||
|
||||
_handleAnnotationClick = () => {
|
||||
// TODO: jump to annotations pane
|
||||
let pane;
|
||||
|
|
|
|||
|
|
@ -118,6 +118,10 @@ import { getCSSItemTypeIcon } from 'components/icons';
|
|||
row.append(remove);
|
||||
}
|
||||
|
||||
row.addEventListener('dragstart', (event) => {
|
||||
Zotero.Utilities.Internal.onDragItems(event, [id]);
|
||||
});
|
||||
|
||||
body.append(row);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -144,6 +144,10 @@ import { getCSSItemTypeIcon } from 'components/icons';
|
|||
row.append(remove);
|
||||
}
|
||||
|
||||
row.addEventListener('dragstart', (event) => {
|
||||
Zotero.Utilities.Internal.onDragItems(event, [id]);
|
||||
});
|
||||
|
||||
body.append(row);
|
||||
}
|
||||
this._updateCount();
|
||||
|
|
|
|||
|
|
@ -3289,7 +3289,12 @@ Zotero.Utilities.Internal.OpenURL = {
|
|||
},
|
||||
};
|
||||
|
||||
Zotero.Utilities.Internal.onDragItems = function (event, itemIDs, dragImage) {
|
||||
/**
|
||||
* @param {DragEvent} event
|
||||
* @param {number[]} itemIDs
|
||||
* @param {Element} [dragImage]
|
||||
*/
|
||||
Zotero.Utilities.Internal.onDragItems = function (event, itemIDs, dragImage = event.currentTarget) {
|
||||
// See note in LibraryTreeView::setDropEffect()
|
||||
if (Zotero.isWin || Zotero.isLinux) {
|
||||
event.dataTransfer.effectAllowed = 'copyMove';
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue