mirror of https://github.com/zulip/zulip.git
popovers: Add direct copy to clipboard link feature.
Change the onClick function of copy link of conversation to actually copy the link to clipboard. Fixes: #4621.
This commit is contained in:
parent
6fe0728afa
commit
a2adcfd7fc
|
@ -156,7 +156,7 @@ exports.toggle_actions_popover = function (element, id) {
|
|||
can_unmute_topic: can_unmute_topic,
|
||||
should_display_add_reaction_option: message.sent_by_me,
|
||||
should_display_edit_history_option: should_display_edit_history_option,
|
||||
conversation_time_uri: narrow.by_conversation_and_time_uri(message),
|
||||
conversation_time_uri: narrow.by_conversation_and_time_uri(message, true),
|
||||
narrowed: narrow_state.active(),
|
||||
};
|
||||
|
||||
|
@ -435,13 +435,6 @@ exports.register_click_handlers = function () {
|
|||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
});
|
||||
$('body').on('click', '.popover_narrow_by_conversation_and_time', function (e) {
|
||||
var msgid = $(e.currentTarget).data('message-id');
|
||||
popovers.hide_actions_popover();
|
||||
narrow.by_conversation_and_time(msgid, {trigger: 'popover'});
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
});
|
||||
$('body').on('click', '.popover_toggle_collapse', function (e) {
|
||||
var msgid = $(e.currentTarget).data('message-id');
|
||||
var row = current_msg_list.get_row(msgid);
|
||||
|
@ -500,6 +493,22 @@ exports.register_click_handlers = function () {
|
|||
e.preventDefault();
|
||||
});
|
||||
|
||||
function initClipboard(selector) {
|
||||
return new Clipboard(selector);
|
||||
}
|
||||
initClipboard('.copy_link');
|
||||
|
||||
$('body').on('click', '.copy_link', function (e) {
|
||||
popovers.hide_actions_popover();
|
||||
var id = $(this).attr("data-message-id");
|
||||
var row = $("[zid='" + id + "']");
|
||||
row.find(".alert-copied").css("display", "block");
|
||||
row.find(".alert-copied").delay(1000).fadeOut(300);
|
||||
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
(function () {
|
||||
var last_scroll = 0;
|
||||
|
||||
|
|
|
@ -57,8 +57,8 @@
|
|||
{{/if}}
|
||||
|
||||
<li>
|
||||
<a href="{{ conversation_time_uri }}" class="popover_narrow_by_conversation_and_time" data-message-id="{{message.id}}">
|
||||
<i class="icon-vector-link"></i> {{t "Link to this conversation" }}
|
||||
<a href="#" class="copy_link" data-message-id="{{message.id}}" data-clipboard-text="{{ conversation_time_uri }}">
|
||||
<i class="icon-vector-link"></i> {{t "Copy link to conversation" }}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
|
Loading…
Reference in New Issue