diff --git a/client/src/views/email/list.js b/client/src/views/email/list.js index b1659b90e7..920f2983da 100644 --- a/client/src/views/email/list.js +++ b/client/src/views/email/list.js @@ -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; } diff --git a/client/src/views/record/list.js b/client/src/views/record/list.js index 89d6425a85..ecf8329d81 100644 --- a/client/src/views/record/list.js +++ b/client/src/views/record/list.js @@ -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;