minor: Export function copy_handler.

This makes it potentially possible to call this function from other
code paths such as hotkeys.
This commit is contained in:
Vaibhav
2019-03-26 10:49:56 +05:30
committed by Tim Abbott
parent 1e456eb84c
commit c2e938f758

View File

@@ -73,7 +73,7 @@ function construct_copy_div(div, start_id, end_id) {
} }
} }
function copy_handler() { exports.copy_handler = function () {
// This is the main handler for copying message content via // This is the main handler for copying message content via
// `ctrl+C` in Zulip (note that this is totally independent of the // `ctrl+C` in Zulip (note that this is totally independent of the
// "select region" copy behavior on Linux; that is handled // "select region" copy behavior on Linux; that is handled
@@ -166,7 +166,7 @@ function copy_handler() {
}); });
$('#copytempdiv').remove(); $('#copytempdiv').remove();
}, 0); }, 0);
} };
exports.analyze_selection = function (selection) { exports.analyze_selection = function (selection) {
// Here we analyze our selection to determine if part of a message // Here we analyze our selection to determine if part of a message
@@ -337,7 +337,7 @@ exports.paste_handler = function (event) {
}; };
exports.initialize = function () { exports.initialize = function () {
$(document).on('copy', copy_handler); $(document).on('copy', exports.copy_handler);
$("#compose-textarea").bind('paste', exports.paste_handler); $("#compose-textarea").bind('paste', exports.paste_handler);
$('body').on('paste', '#message_edit_form', exports.paste_handler); $('body').on('paste', '#message_edit_form', exports.paste_handler);
}; };