mirror of
https://github.com/zulip/zulip.git
synced 2025-11-09 08:26:11 +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,12 +213,22 @@ exports.paste_handler_converter = function (paste_html) {
|
|||||||
|
|
||||||
exports.paste_handler = function (event) {
|
exports.paste_handler = function (event) {
|
||||||
var clipboardData = event.originalEvent.clipboardData;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
var paste_html = clipboardData.getData('text/html');
|
if (clipboardData.getData) {
|
||||||
if (paste_html) {
|
var paste_html = clipboardData.getData('text/html');
|
||||||
event.preventDefault();
|
if (paste_html) {
|
||||||
var text = exports.paste_handler_converter(paste_html);
|
event.preventDefault();
|
||||||
compose_ui.insert_syntax_and_focus(text);
|
var text = exports.paste_handler_converter(paste_html);
|
||||||
|
compose_ui.insert_syntax_and_focus(text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user