Fix image paste in polls

pull/1/head
yflory 4 years ago
parent dcaa898310
commit fa6f470688

@ -75,6 +75,21 @@ define([
}
};
module.handleImagePaste = function (editor) {
// Don't paste file path in the users wants to paste a file
editor.on('paste', function (editor, ev) {
try {
if (!ev.clipboardData.items) { return; }
var items = Array.prototype.slice.apply(ev.clipboardData.items);
var hasFile = items.some(function (el) {
return el.kind === "file";
});
if (!hasFile) { return; }
ev.preventDefault();
} catch (e) { console.error(e); }
});
};
module.getHeadingText = function (editor) {
var lines = editor.getValue().split(/\n/);
@ -234,18 +249,7 @@ define([
editor.scrollIntoView(cursor);
});
// Don't paste file path in the users wants to paste a file
editor.on('paste', function (editor, ev) {
try {
if (!ev.clipboardData.items) { return; }
var items = Array.prototype.slice.apply(ev.clipboardData.items);
var hasFile = items.some(function (el) {
return el.kind === "file";
});
if (!hasFile) { return; }
ev.preventDefault();
} catch (e) { console.error(e); }
});
module.handleImagePaste(editor);
var setMode = exp.setMode = function (mode, cb) {
exp.highlightMode = mode;

@ -959,6 +959,8 @@ define([
};
common.createFileManager(fmConfig);
SframeCM.handleImagePaste(APP.editor);
// Initialize author name for comments.
// Disable name modification for logged in users
var $cName = APP.$addComment.find('.cp-app-poll-comments-add-name')

Loading…
Cancel
Save