Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

copy_messages: noop for empty selection.

Apoorva Pendse795c05784faa
diff --git a/web/src/copy_messages.ts b/web/src/copy_messages.ts
index 8ed4b267cdd..8885cc8fc9d 100644
--- a/web/src/copy_messages.ts
+++ b/web/src/copy_messages.ts
@@ -142,6 +142,10 @@ function remove_div(_div: JQuery, ranges: Range[]): void {
}
function copy_selection_to_clipboard(selection: Selection): void {
+ if (selection.rangeCount === 0) {
+ return;
+ }
+
const range = selection.getRangeAt(0);
const div = document.createElement("div");
div.append(range.cloneContents());