mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 08:56:10 +00:00
copy_and_paste.js: Fix exception on IE11 with clipboardData.
On IE11, ClipboardData isn't defined; one can instead access it with `window.clipboardData`, but that doesn't support text/html, so this code path couldn't do anything special anyway. So we instead just let the default paste handler run on IE11. Fixes #8850.
This commit is contained in:
@@ -213,13 +213,23 @@ exports.paste_handler_converter = function (paste_html) {
|
||||
|
||||
exports.paste_handler = function (event) {
|
||||
var clipboardData = event.originalEvent.clipboardData;
|
||||
if (!clipboardData) {
|
||||
// On IE11, ClipboardData isn't defined. One can instead
|
||||
// access it with `window.clipboardData`, but even that
|
||||
// doesn't support text/html, so this code path couldn't do
|
||||
// anything special anyway. So we instead just let the
|
||||
// default paste handler run on IE11.
|
||||
return;
|
||||
}
|
||||
|
||||
if (clipboardData.getData) {
|
||||
var paste_html = clipboardData.getData('text/html');
|
||||
if (paste_html) {
|
||||
event.preventDefault();
|
||||
var text = exports.paste_handler_converter(paste_html);
|
||||
compose_ui.insert_syntax_and_focus(text);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$(function () {
|
||||
|
||||
Reference in New Issue
Block a user