mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-11 09:50:27 +00:00
Fix bug that was preventing pasting into edit textareas or input boxes
This commit is contained in:
parent
588c7cb07f
commit
45ee2b3048
@ -91,27 +91,31 @@ ImportWidget.prototype.handleDropEvent = function(event) {
|
||||
};
|
||||
|
||||
ImportWidget.prototype.handlePasteEvent = function(event) {
|
||||
var self = this,
|
||||
items = event.clipboardData.items;
|
||||
for(var t = 0; t<items.length; t++) {
|
||||
var item = items[t];
|
||||
if(item.kind === "file") {
|
||||
var file = item.getAsFile();
|
||||
this.importFiles([file]);
|
||||
} else if(item.kind === "string") {
|
||||
item.getAsString(function(str) {
|
||||
var fields = {
|
||||
title: self.generateTitle("Untitled"),
|
||||
text: str
|
||||
}
|
||||
self.renderer.renderTree.wiki.addTiddler(new $tw.Tiddler(fields));
|
||||
self.openTiddler(fields.title);
|
||||
});
|
||||
if(["TEXTAREA","INPUT"].indexOf(event.srcElement.tagName) == -1) {
|
||||
var self = this,
|
||||
items = event.clipboardData.items;
|
||||
for(var t = 0; t<items.length; t++) {
|
||||
var item = items[t];
|
||||
if(item.kind === "file") {
|
||||
var file = item.getAsFile();
|
||||
this.importFiles([file]);
|
||||
} else if(item.kind === "string") {
|
||||
item.getAsString(function(str) {
|
||||
var fields = {
|
||||
title: self.generateTitle("Untitled"),
|
||||
text: str
|
||||
}
|
||||
self.renderer.renderTree.wiki.addTiddler(new $tw.Tiddler(fields));
|
||||
self.openTiddler(fields.title);
|
||||
});
|
||||
}
|
||||
}
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
return false;
|
||||
};
|
||||
|
||||
ImportWidget.prototype.openTiddler = function(title) {
|
||||
|
Loading…
Reference in New Issue
Block a user