mirror of https://github.com/zulip/zulip.git
In the desktop app, paste emoji as text to work around webkit bug
See Trac #1060 (imported from commit 860f16c5a9db626a4fd2d55bcb0dd137e5196560)
This commit is contained in:
parent
6cd0b0468d
commit
ee3806ef5b
|
@ -174,9 +174,7 @@ function process_notification(notification) {
|
|||
|
||||
// Convert the content to plain text, replacing emoji with their alt text
|
||||
content = $('<div/>').html(message.content);
|
||||
content.find(".emoji").replaceWith(function () {
|
||||
return $(this).attr("alt");
|
||||
});
|
||||
ui.replace_emoji_with_text(content);
|
||||
content = content.text();
|
||||
|
||||
if (message.type === "private") {
|
||||
|
|
|
@ -114,6 +114,12 @@ function find_boundary_tr(initial_tr, iterate_row) {
|
|||
return [rows.id(tr), skip_same_td_check];
|
||||
}
|
||||
|
||||
exports.replace_emoji_with_text = function (element) {
|
||||
element.find(".emoji").replaceWith(function () {
|
||||
return $(this).attr("alt");
|
||||
});
|
||||
};
|
||||
|
||||
function copy_handler(e) {
|
||||
var selection = window.getSelection();
|
||||
var i, range, ranges = [], startc, endc, initial_end_tr, start_id, end_id, row, message;
|
||||
|
@ -183,6 +189,13 @@ function copy_handler(e) {
|
|||
}
|
||||
}
|
||||
|
||||
if (window.bridge !== undefined) {
|
||||
// If the user is running the desktop app,
|
||||
// convert emoji images to plain text for
|
||||
// copy-paste purposes.
|
||||
exports.replace_emoji_with_text(div);
|
||||
}
|
||||
|
||||
// Select div so that the browser will copy it
|
||||
// instead of copying the original selection
|
||||
div.css({position: 'absolute', 'left': '-99999px'})
|
||||
|
|
Loading…
Reference in New Issue