Check that we have items in markdown cell paste handler

This commit is contained in:
Julien Rebetez 2015-10-30 10:52:00 +01:00 committed by Julien Rebetez
parent e66ff8f001
commit 646619d5cd

View File

@ -406,14 +406,16 @@ define([
$(div).on('paste', function(evt) {
var data = evt.originalEvent.clipboardData;
var items = data.items;
for (var i = 0; i < items.length; ++i) {
var item = items[i];
if (item.kind == 'file' && attachment_regex.test(item.type)) {
// TODO(julienr): This does not stop code_mirror from pasting
// the filename.
evt.stopPropagation();
evt.preventDefault();
that.insert_inline_image_from_blob(item.getAsFile());
if (data.items !== undefined) {
for (var i = 0; i < items.length; ++i) {
var item = items[i];
if (item.kind == 'file' && attachment_regex.test(item.type)) {
// TODO(julienr): This does not stop code_mirror from pasting
// the filename.
evt.stopPropagation();
evt.preventDefault();
that.insert_inline_image_from_blob(item.getAsFile());
}
}
}
});