mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 06:55:46 +01:00
can paste images directly from clipboard
This commit is contained in:
@@ -94,8 +94,9 @@ define(['taskbar'], function(taskbar) {
|
|||||||
|
|
||||||
var postContainer = $(composerTemplate[0]);
|
var postContainer = $(composerTemplate[0]);
|
||||||
|
|
||||||
if(config.allowFileUploads || config.imgurClientIDSet)
|
if(config.allowFileUploads || config.imgurClientIDSet) {
|
||||||
initializeFileReader(post_uuid);
|
initializeFileReader(post_uuid);
|
||||||
|
}
|
||||||
|
|
||||||
var postData = composer.posts[post_uuid],
|
var postData = composer.posts[post_uuid],
|
||||||
titleEl = postContainer.find('.title'),
|
titleEl = postContainer.find('.title'),
|
||||||
@@ -540,6 +541,14 @@ define(['taskbar'], function(taskbar) {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(window).off('paste').on('paste', function(event) {
|
||||||
|
var items = (event.clipboardData || event.originalEvent.clipboardData).items;
|
||||||
|
if(items && items.length) {
|
||||||
|
var blob = items[0].getAsFile();
|
||||||
|
loadFile(post_uuid, blob);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -552,7 +561,7 @@ define(['taskbar'], function(taskbar) {
|
|||||||
var matches = this.result.match(regex);
|
var matches = this.result.match(regex);
|
||||||
|
|
||||||
var fileData = {
|
var fileData = {
|
||||||
name: file.name,
|
name: file.name || '',
|
||||||
data: matches[1]
|
data: matches[1]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user