This commit is contained in:
Yuri Kuznetsov
2022-10-06 18:36:59 +03:00
parent 097a600488
commit 8815564be3
2 changed files with 28 additions and 5 deletions
+19 -5
View File
@@ -89,8 +89,17 @@ define('views/email/list', ['views/list'], function (Dep) {
e.originalEvent.dataTransfer.effectAllowed = 'move';
e.originalEvent.dataTransfer.setData('text/plain', id);
$target.closest('tr').addClass('active');
},
'dragend a.link': function () {
'dragend a.link': function (e) {
let $target = $(e.target);
let id = $target.attr('data-id');
if (!this.getRecordView().isIdChecked(id)) {
$target.closest('tr').removeClass('active');
}
this.draggedEmailId = null;
},
'dragenter .folder-list > li.droppable': function (e) {
@@ -127,15 +136,20 @@ define('views/email/list', ['views/list'], function (Dep) {
this.onDrop(id, folderId);
},
'dragover .folder-list > li.droppable': function (e) {
e.preventDefault();
},
...Dep.prototype.events,
},
setup: function () {
Dep.prototype.setup.call(this);
$(document).on('dragover.' + this.cid, e => {
if (this.draggedEmailId) {
e.preventDefault();
}
});
this.once('remove', () => $(document).off('dragover.' + this.cid));
this.addMenuItem('dropdown', false);
if (this.getAcl().checkScope('EmailAccountScope')) {
@@ -313,7 +327,7 @@ define('views/email/list', ['views/list'], function (Dep) {
onDrop: function (id, folderId) {
if (folderId === this.FOLDER_IMPORTANT) {
this.getRecordView().actionMarkAsImportant({id: id});
setTimeout(() => this.getRecordView().actionMarkAsImportant({id: id}), 10);
return;
}
+9
View File
@@ -3129,6 +3129,15 @@ function (Dep, MassActionHelper, ExportHelper, RecordModal) {
}
},
/**
* @public
* @param {string} id An ID.
* @return {boolean}
*/
isIdChecked: function (id) {
return this.checkedList.indexOf(id) !== -1;
},
getTableMinWidth: function () {
if (!this.listLayout) {
return;