Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions resources/js/makegrid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2615,8 +2615,9 @@ const makeGrid = function (t, enableResize = undefined, enableReorder = undefine

selectCell(this);

// Prevent text selection
e.preventDefault();
$(g.t).on('mouseleave.cellSelect', 'td.data', function () {
window.getSelection().removeAllRanges();
});

// Dynamic mouseover for drag
$(g.t).on('mouseover.cellSelect', 'td.data, thead th:not(.column_action)', function (e) {
Expand Down Expand Up @@ -2659,13 +2660,15 @@ const makeGrid = function (t, enableResize = undefined, enableReorder = undefine
$(document).on('mouseup.cellSelect', function () {
g.isSelectingCells = false;
$(g.t).off('mouseover.cellSelect');
$(g.t).off('mouseleave.cellSelect');
$(document).off('mouseup.cellSelect');
});
});

// Copy handler
$(document).on('copy', function (e) {
if (!document.body.contains(g.t) || g.isCellEditActive) {
const selection = window.getSelection();
if (!document.body.contains(g.t) || g.isCellEditActive || (selection.rangeCount > 0 && !selection.isCollapsed)) {
return;
}

Expand Down
Loading