Fix: allow selecting text fragments in cells

Signed-off-by: Iakov Ogryzkov <justjacob951@gmail.com>
This commit is contained in:
Iakov Ogryzkov 2026-03-27 16:02:33 +01:00
parent e1bc3d7dbe
commit 61619738fc
No known key found for this signature in database
GPG Key ID: 797999D464347CC2

View File

@ -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) {
@ -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;
}