Skip to content

Commit

Permalink
* dtable: prevent to drag link on sort rows.
Browse files Browse the repository at this point in the history
  • Loading branch information
catouse committed May 22, 2024
1 parent a96c65d commit 4c767d8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/dtable/src/plugins/sortable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ const sortablePlugin: DTablePlugin<DTableSortableTypes, [DTableMousemoveTypes, D
return;
}
const {sortHandler = '.dtable-cell'} = this.options;
const $handler = $(event.target as HTMLElement).closest(sortHandler);
const $target = $(event.target as HTMLElement);
const $handler = $target.closest(sortHandler);
if (!$handler.length) {
return;
}
Expand All @@ -91,6 +92,9 @@ const sortablePlugin: DTablePlugin<DTableSortableTypes, [DTableMousemoveTypes, D
if (!row || this.options.onSortStart?.call(this, row, event) === false) {
return;
}
if ($target.closest('a,button,img').attr('draggable', 'false').length) {
event.preventDefault();
}
const startMouseY = event.clientY;
this.data.sortableInfo = {from: row, offset: startMouseY - info.cellElement.getBoundingClientRect().top, startMouseY, lastMouseY: startMouseY};
},
Expand Down

0 comments on commit 4c767d8

Please sign in to comment.