mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 17:07:07 +00:00
Allow copying and pasting from zephyrs without triggering a compose.
(imported from commit f98a14155904dda11d85ed81acee783494377e4d)
This commit is contained in:
@@ -32,7 +32,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td class="pointer"><p></p></td>
|
<td class="pointer"><p></p></td>
|
||||||
<td class="messagebox{{^include_sender}} prev_is_same_sender{{/include_sender}}{{^is_class}} personal-message{{/is_class}}"
|
<td class="messagebox{{^include_sender}} prev_is_same_sender{{/include_sender}}{{^is_class}} personal-message{{/is_class}}"
|
||||||
onclick="select_zephyr_by_id({{id}}); respond_to_zephyr();">
|
onmousedown="zephyr_mousedown();" onmousemove="zephyr_mousemove();">
|
||||||
{{#include_sender}}
|
{{#include_sender}}
|
||||||
<span class="zephyr_label_clickable zephyr_sender"
|
<span class="zephyr_label_clickable zephyr_sender"
|
||||||
onmouseover="show_email({{id}});"
|
onmouseover="show_email({{id}});"
|
||||||
|
|||||||
@@ -34,6 +34,12 @@ function process_hotkey(code) {
|
|||||||
window_to_scroll = $(".active").find(".scrolling-tab");
|
window_to_scroll = $(".active").find(".scrolling-tab");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (num_pressed_keys() > 1) {
|
||||||
|
// If you are already holding down another key, none of these
|
||||||
|
// actions apply.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 33: // Page Up
|
case 33: // Page Up
|
||||||
window_to_scroll.scrollTop(window_to_scroll.scrollTop() - window_to_scroll.height());
|
window_to_scroll.scrollTop(window_to_scroll.scrollTop() - window_to_scroll.height());
|
||||||
@@ -96,6 +102,24 @@ function process_compose_hotkey(code) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var pressed_keys = {};
|
||||||
|
|
||||||
|
function num_pressed_keys() {
|
||||||
|
var size = 0, key;
|
||||||
|
for (key in pressed_keys) {
|
||||||
|
if (pressed_keys.hasOwnProperty(key)) size++;
|
||||||
|
}
|
||||||
|
return size;
|
||||||
|
};
|
||||||
|
|
||||||
|
$(document).keydown(function (e) {
|
||||||
|
pressed_keys[e.which] = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).keyup(function (e) {
|
||||||
|
pressed_keys = {};
|
||||||
|
});
|
||||||
|
|
||||||
/* The current handler function for keydown events.
|
/* The current handler function for keydown events.
|
||||||
It should return a new handler, or 'false' to
|
It should return a new handler, or 'false' to
|
||||||
decline to handle the event. */
|
decline to handle the event. */
|
||||||
|
|||||||
@@ -31,6 +31,18 @@ function register_huddle_onclick(zephyr_row, sender) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function register_onclick(zephyr_row, zephyr_id) {
|
||||||
|
zephyr_row.find(".messagebox").click(function (e) {
|
||||||
|
if (!(clicking && mouse_moved)) {
|
||||||
|
// Was a click (not a click-and-drag).
|
||||||
|
select_zephyr_by_id(zephyr_id);
|
||||||
|
respond_to_zephyr();
|
||||||
|
}
|
||||||
|
mouse_moved = false;
|
||||||
|
clicking = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
var zephyr_array = [];
|
var zephyr_array = [];
|
||||||
var zephyr_dict = {};
|
var zephyr_dict = {};
|
||||||
var instance_list = [];
|
var instance_list = [];
|
||||||
@@ -427,6 +439,20 @@ function select_zephyr_by_id(zephyr_id) {
|
|||||||
select_zephyr(get_zephyr_row(zephyr_id), false);
|
select_zephyr(get_zephyr_row(zephyr_id), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var clicking = false;
|
||||||
|
var mouse_moved = false;
|
||||||
|
|
||||||
|
function zephyr_mousedown() {
|
||||||
|
mouse_moved = false;
|
||||||
|
clicking = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function zephyr_mousemove() {
|
||||||
|
if (clicking) {
|
||||||
|
mouse_moved = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Called on page load and when we [un]narrow.
|
// Called on page load and when we [un]narrow.
|
||||||
// Forces a call to select_zephyr even if the id has not changed,
|
// Forces a call to select_zephyr even if the id has not changed,
|
||||||
// because the visible table might have.
|
// because the visible table might have.
|
||||||
@@ -715,7 +741,9 @@ function add_to_table(zephyrs, table_name, filter_function) {
|
|||||||
table.append(templates.zephyr({'zephyrs': zephyrs_to_render}));
|
table.append(templates.zephyr({'zephyrs': zephyrs_to_render}));
|
||||||
|
|
||||||
$.each(zephyrs_to_render, function (index, zephyr) {
|
$.each(zephyrs_to_render, function (index, zephyr) {
|
||||||
register_huddle_onclick(get_zephyr_row(zephyr.id), zephyr.sender_email);
|
var row = get_zephyr_row(zephyr.id);
|
||||||
|
register_huddle_onclick(row, zephyr.sender_email);
|
||||||
|
register_onclick(row, zephyr.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
$.each(ids_where_next_is_same_sender, function (index, id) {
|
$.each(ids_where_next_is_same_sender, function (index, id) {
|
||||||
|
|||||||
Reference in New Issue
Block a user