fix(ui): allow dragging up for a multi-line comment (#13296)

Close #13287

Remove the limitation that only allow dragging down

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13296
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
This commit is contained in:
steven.guiheux 2026-07-05 02:49:50 +02:00 committed by Mathieu Fenniak
commit f4cdb8bd19

View file

@ -594,14 +594,15 @@ export function initRepoPullRequestReview() {
const filePath = this.closest('[data-path]')?.getAttribute('data-path');
if (filePath !== multiLineDrag.path) return;
// Only extend downward (end >= start)
if (lineNum < multiLineDrag.startIdx) return;
multiLineDrag.currentIdx = lineNum;
// Update highlight
// Update highlight; the drag can go both ways, highlightLineRange needs ordered bounds
clearMultiLineSelection();
highlightLineRange(multiLineDrag.path, multiLineDrag.side, multiLineDrag.startIdx, multiLineDrag.currentIdx);
highlightLineRange(
multiLineDrag.path, multiLineDrag.side,
Math.min(multiLineDrag.startIdx, multiLineDrag.currentIdx),
Math.max(multiLineDrag.startIdx, multiLineDrag.currentIdx),
);
});
// Mouseup: finalize multi-line selection