From acaddc2d4e783ecc93491e739b33c4bcc0d98c9c Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Mon, 10 Mar 2025 14:30:51 -0700 Subject: [PATCH] copy_messages: Rename select_div for clarity. --- web/src/copy_messages.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/src/copy_messages.ts b/web/src/copy_messages.ts index 673d3b2f16..f91f2de4ad 100644 --- a/web/src/copy_messages.ts +++ b/web/src/copy_messages.ts @@ -109,7 +109,7 @@ function construct_copy_div($div: JQuery, start_id: number, end_id: number): voi } } -function select_div($div: JQuery, selection: Selection): void { +function insert_and_select_div($div: JQuery, selection: Selection): void { $div.css({ position: "absolute", left: "-99999px", @@ -245,7 +245,6 @@ export function copy_handler(): void { const start_id = analysis.start_id; const end_id = analysis.end_id; const skip_same_td_check = analysis.skip_same_td_check; - const $div = $("
"); if (start_id === undefined || end_id === undefined || start_id > end_id) { // In this case either the starting message or the ending @@ -282,11 +281,12 @@ export function copy_handler(): void { // chance for overlaps between same message ids, avoiding which is much // more difficult since we can get a range (start_id and end_id) for // each selection `Range`. + const $div = $("
"); construct_copy_div($div, start_id, end_id); // Select div so that the browser will copy it // instead of copying the original selection - select_div($div, selection); + insert_and_select_div($div, selection); // eslint-disable-next-line @typescript-eslint/no-deprecated document.execCommand("copy"); setTimeout(() => {